Search in sources :

Example 31 with Provider

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());
}
Also used : Provider(org.openmrs.Provider) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 32 with Provider

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());
}
Also used : Provider(org.openmrs.Provider) GlobalProperty(org.openmrs.GlobalProperty) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 33 with Provider

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());
}
Also used : Person(org.openmrs.Person) Provider(org.openmrs.Provider) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 34 with Provider

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());
}
Also used : Provider(org.openmrs.Provider) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 35 with Provider

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());
}
Also used : Provider(org.openmrs.Provider) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Aggregations

Provider (org.openmrs.Provider)49 Test (org.junit.Test)40 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)33 Encounter (org.openmrs.Encounter)16 Date (java.util.Date)12 Person (org.openmrs.Person)10 Patient (org.openmrs.Patient)9 EncounterType (org.openmrs.EncounterType)8 EncounterRole (org.openmrs.EncounterRole)7 Location (org.openmrs.Location)7 PersonName (org.openmrs.PersonName)6 TestOrder (org.openmrs.TestOrder)5 Message (ca.uhn.hl7v2.model.Message)4 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)4 DrugOrder (org.openmrs.DrugOrder)4 Order (org.openmrs.Order)4 OrderUtilTest (org.openmrs.order.OrderUtilTest)4 Criteria (org.hibernate.Criteria)3 Concept (org.openmrs.Concept)3 User (org.openmrs.User)3