Junit Testing throwing NullPointerException

when I am doing Junit testing for my service file I am having null point exception, I don’t understand why, I even tried mocking the repository service
I was writing my first test cases so I don’t know much.

@Test
public void startProcess_whenGetDeploymentId_Deployment(){
when(flowableRule.getRepositoryService()).thenReturn(repositoryService);
when(repositoryService.createDeployment().addInputStream(resource,inputstream).deploy()).thenReturn(deployment);

Deployment testDeployment = repositoryService.createDeployment().addInputStream(resource,inputstream)
.deploy();
assertEquals(testDeployment.getClass(),deployment.getClass());
}

Similiar issue with the following

@Test
@org.flowable.engine.test.Deployment(resources={“processes/kycblk.bpmn20.xml”})
public void completeProcess_whenGetHistoricProcessInstance_String() {
// when(processEngine.getHistoryService()).thenReturn(historyService);
when(historyService.createHistoricProcessInstanceQuery().involvedUser(“dummy”).unfinished().list()).thenReturn(historicProcessInstances);
List<HistoricProcessInstance> testHistoricProcessInstances = historyService.createHistoricProcessInstanceQuery().involvedUser(“dummy”).unfinished().list();
assertEquals(historicProcessInstances.size(), testHistoricProcessInstances.size());
}