public void checkAlreadyUsedOrValidHealthDashBoardToken(ServiceCode serviceCode) {
if(serviceCode.getHealthDashBoardToken().isEmpty()) {
return;
} else if(isAlreadyUsedHealthDashBoardToken(serviceCode)) {
throw new GlobalException(ResponseType.SERVICE_ALREADY_USED_HEALTH_DASHBOARD_TOKEN);
} else if(!isValidHealthDashBoardToken(serviceCode)) {
throw new GlobalException(ResponseType.SERVICE_NOT_VALID_HEALTH_DASHBOARD_TOKEN);
}
}
@Test(expected = GlobalException.class)
public void checkAlreadyUsedOrValidHealthDashBoardTokenTest() {
List<ServiceCode> serviceCodeList = new ArrayList<ServiceCode>();
serviceCodeList.add(serviceCode);
Mockito.when(serviceManageMapper.selectServiceByHashBoardToken((ServiceCode)notNull())).thenReturn(serviceCodeList);
// execute test
}
I just want to test void method. how can I execute the test? Please help me.
Aucun commentaire:
Enregistrer un commentaire