use of org.openmrs.Provider in project openmrs-core by openmrs.
the class ProviderServiceTest method getProvider_shouldGetProviderGivenID.
/**
* @see ProviderService#getProvider(Integer)
*/
@Test
public void getProvider_shouldGetProviderGivenID() {
Provider provider = service.getProvider(2);
assertEquals("Mr. Horatio Test Hornblower", provider.getName());
}
use of org.openmrs.Provider in project openmrs-core by openmrs.
the class ProviderServiceTest method getUnknownProvider_shouldGetTheUnknownProviderAccount.
/**
* @see ProviderService#getUnknownProvider()
*/
@Test
public void getUnknownProvider_shouldGetTheUnknownProviderAccount() {
Provider provider = new Provider();
provider.setPerson(newPerson("Unknown Provider"));
provider.setIdentifier("Test Unknown Provider");
provider = service.saveProvider(provider);
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GP_UNKNOWN_PROVIDER_UUID, provider.getUuid(), null);
Context.getAdministrationService().saveGlobalProperty(gp);
assertEquals(provider, service.getUnknownProvider());
}
use of org.openmrs.Provider in project openmrs-core by openmrs.
the class ProviderServiceTest method saveProvider_shouldSaveAProviderWithPersonAlone.
/**
* @see ProviderService#saveProvider(Provider)
*/
@Test
public void saveProvider_shouldSaveAProviderWithPersonAlone() {
Provider provider = new Provider();
provider.setIdentifier("unique");
Person person = Context.getPersonService().getPerson(999);
provider.setPerson(person);
service.saveProvider(provider);
Assert.assertNotNull(provider.getId());
Assert.assertNotNull(provider.getUuid());
Assert.assertNotNull(provider.getCreator());
Assert.assertNotNull(provider.getDateCreated());
Assert.assertEquals(999, provider.getPerson().getId().intValue());
}
use of org.openmrs.Provider in project openmrs-core by openmrs.
the class ProviderServiceTest method retireProvider_shouldRetireAProvider.
/**
* @see ProviderService#retireProvider(Provider,String)
*/
@Test
public void retireProvider_shouldRetireAProvider() {
Provider provider = service.getProvider(1);
assertFalse(provider.getRetired());
assertNull(provider.getRetireReason());
service.retireProvider(provider, "retire reason");
assertTrue(provider.getRetired());
assertEquals("retire reason", provider.getRetireReason());
assertEquals(6, service.getAllProviders(false).size());
}
use of org.openmrs.Provider in project openmrs-core by openmrs.
the class ProviderServiceTest method getProviderByIdentifier_shouldGetAProviderMatchingTheSpecifiedIdentifierIgnoringCase.
/**
* @see ProviderService#getProviderByIdentifier(String)
*/
@Test
public void getProviderByIdentifier_shouldGetAProviderMatchingTheSpecifiedIdentifierIgnoringCase() {
String identifier = "8a760";
Provider provider = service.getProviderByIdentifier(identifier);
Assert.assertEquals("a2c3868a-6b90-11e0-93c3-18a905e044dc", provider.getUuid());
// ensures that the case sensitive test stays valid just in case
// the test dataset is edited and the case is changed
Assert.assertNotSame(identifier, provider.getIdentifier());
}
Aggregations