public void setEncounterService(EncounterService encounterService) { setService(EncounterService.class, encounterService); this.encounterService = encounterService; }
/** * @since 1.11, 1.10, 1.9.9 */ @After public void revertContextMocks() { contextMockHelper.revertMocks(); }
public void setUserContext(UserContext userContext) { if (!userContextMocked) { try { realUserContext = Context.getUserContext(); } catch (Exception e) { //let's not fail if context is not configured } userContextMocked = true; } Context.setUserContext(userContext); this.userContext = userContext; authenticateMockUser(); }
@Before public void before() { patientService = new PatientServiceImpl(); patientService.setPatientDAO(patientDaoMock); this.contextMockHelper.setPatientService(patientService); }
@Test public void processDeath_shouldMapValuesAndSavePatient() throws Exception { // given final Date dateDied = new Date(); final Concept causeOfDeath = new Concept(2); when(conceptService.getConcept(anyString())).thenReturn(new Concept()); when(locationService.getDefaultLocation()).thenReturn(new Location()); UserContext userContext = mock(UserContext.class); this.contextMockHelper.setUserContext(userContext); when(userContext.hasPrivilege(anyString())).thenReturn(true); ArgumentCaptor<Patient> argumentCaptor = ArgumentCaptor.forClass(Patient.class); when(patientDaoMock.savePatient(argumentCaptor.capture())).thenReturn(new Patient()); // when final Patient patient = new Patient(); patient.addIdentifier(new PatientIdentifier("an identifier", new PatientIdentifierType(1234), new Location())); patientService.processDeath(patient, dateDied, causeOfDeath, "unknown"); // then final Patient savedPatient = argumentCaptor.getValue(); assertEquals(true, savedPatient.getDead()); assertEquals(dateDied, savedPatient.getDeathDate()); assertEquals(causeOfDeath, savedPatient.getCauseOfDeath()); }
@After public void revertContextMocks() { contextMockHelper.revertMocks(); } }
public void setLocationService(LocationService locationService) { setService(LocationService.class, locationService); this.locationService = locationService; }
public void setObsService(ObsService obsService) { setService(ObsService.class, obsService); this.obsService = obsService; }
public void setPatientService(PatientService patientService) { setService(PatientService.class, patientService); this.patientService = patientService; }
public void setAdministrationService(AdministrationService administrationService) { setService(AdministrationService.class, administrationService); this.administrationService = administrationService; }
public void setConceptService(ConceptService conceptService) { setService(ConceptService.class, conceptService); this.conceptService = conceptService; }
public void setSerializationService(SerializationService serializationService) { setService(SerializationService.class, serializationService); this.serializationService = serializationService; }
public void setCohortService(CohortService cohortService) { setService(CohortService.class, cohortService); this.cohortService = cohortService; }
public void setDatatypeService(DatatypeService datatypeService) { setService(DatatypeService.class, datatypeService); this.datatypeService = datatypeService; }
public void setFormService(FormService formService) { setService(FormService.class, formService); this.formService = formService; }
public void setMessageSourceService(MessageSourceService messageSourceService) { setService(MessageSourceService.class, messageSourceService); this.messageSourceService = messageSourceService; }
public void setOrderService(OrderService orderService) { setService(OrderService.class, orderService); this.orderService = orderService; }
public void setProviderService(ProviderService providerService) { setService(ProviderService.class, providerService); this.providerService = providerService; }
public void setUserService(UserService userService) { setService(UserService.class, userService); this.userService = userService; }
public void setVisitService(VisitService visitService) { setService(VisitService.class, visitService); this.visitService = visitService; }