use of org.motechproject.mots.testbuilder.CommunityHealthWorkerDataBuilder in project mots by motech-implementations.
the class ModuleAssignmentServiceTest method assignModulesShouldThrowIfIvrIdIsNotSet.
@Test(expected = ModuleAssignmentException.class)
public void assignModulesShouldThrowIfIvrIdIsNotSet() {
final CommunityHealthWorker chw = new CommunityHealthWorkerDataBuilder().withIvrId(null).build();
final AssignedModules assignedModules = new AssignedModulesDataBuilder().withChw(chw).build();
when(assignedModulesRepository.findByHealthWorkerId(eq(chw.getId()))).thenReturn(Optional.of(assignedModules));
moduleAssignmentService.assignModules(assignedModules);
}
use of org.motechproject.mots.testbuilder.CommunityHealthWorkerDataBuilder in project mots by motech-implementations.
the class ModuleAssignmentServiceTest method assignModulesToDistrictShouldThrowIfIvrIdIsNotSet.
@Test(expected = ModuleAssignmentException.class)
public void assignModulesToDistrictShouldThrowIfIvrIdIsNotSet() {
CommunityHealthWorker chw = new CommunityHealthWorkerDataBuilder().withIvrId(null).build();
AssignedModules assignedModules = new AssignedModulesDataBuilder().withChw(chw).build();
when(communityHealthWorkerRepository.findByCommunityFacilityChiefdomDistrictIdAndSelected(any(), any())).thenReturn(Collections.singletonList(chw));
when(assignedModulesRepository.findByHealthWorkerId(eq(chw.getId()))).thenReturn(Optional.of(assignedModules));
moduleAssignmentService.assignModulesToDistrict(districtAssignmentDto);
}
Aggregations