Example #1
0
  @Test
  public void testFindById() throws Exception {
    Client client2 = new Client(2, "Fedor");
    client2.addPet("Cat", "Pushok");
    client2.addPet("Dog", "Bull");

    assertEquals(myClinic.findById(2), client2);
  }
Example #2
0
 @Test
 public void testFindByClientName() throws Exception {
   List<Client> clients = new ArrayList<>();
   Client client2 = new Client(2, "Fedor");
   client2.addPet("Cat", "Pushok");
   client2.addPet("Dog", "Bull");
   clients.add(client2);
   assertEquals(myClinic.findByClientName("Fedor"), clients);
 }
Example #3
0
  @Test
  public void testGetClients() throws Exception {
    List<Client> clients = new ArrayList<>();
    clients.add(new Client(1, "Vasya"));
    clients.get(0).addPet("Cat", "Pushok");
    clients.add(new Client(2, "Fedor"));
    clients.get(1).addPet("Cat", "Pushok");
    clients.get(1).addPet("Dog", "Bull");
    clients.add(new Client(3, "Grisha"));

    assertEquals(myClinic.getClients(), clients);
  }
Example #4
0
 @Before
 public void setUp() throws Exception {
   myClinic.addClient(1, "Vasya");
   myClinic.addPetForClient(1, "Cat", "Pushok");
   myClinic.addClient(2, "Fedor");
   myClinic.addPetForClient(2, "Cat", "Pushok");
   myClinic.addPetForClient(2, "Dog", "Bull");
   myClinic.addClient(3, "Grisha");
 }
 public static void fillFieldsfromXML(
     org.dom4j.Element el, ims.domain.DomainFactory factory, Clinic obj, java.util.HashMap domMap)
     throws Exception {
   org.dom4j.Element fldEl;
   fldEl = el.element("clinicName");
   if (fldEl != null) {
     obj.setClinicName(new String(fldEl.getTextTrim()));
   }
   fldEl = el.element("clinicLocation");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setClinicLocation(
         ims.core.resource.place.domain.objects.Location.getLocationfromXML(
             fldEl, factory, domMap));
   }
   fldEl = el.element("isActive");
   if (fldEl != null) {
     obj.setIsActive(new Boolean(fldEl.getTextTrim()));
   }
   fldEl = el.element("upperName");
   if (fldEl != null) {
     obj.setUpperName(new String(fldEl.getTextTrim()));
   }
   fldEl = el.element("codeMappings");
   if (fldEl != null) {
     fldEl = fldEl.element("list");
     obj.setCodeMappings(
         ims.core.clinical.domain.objects.TaxonomyMap.fromListXMLString(
             fldEl, factory, obj.getCodeMappings(), domMap));
   }
   fldEl = el.element("outpatientDept");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setOutpatientDept(
         ims.core.resource.place.domain.objects.Location.getLocationfromXML(
             fldEl, factory, domMap));
   }
 }
Example #6
0
 @Test
 public void testRemoveClient() throws Exception {
   assertEquals(myClinic.getClients().size(), 3);
   myClinic.removeClient(3);
   assertEquals(myClinic.getClients().size(), 2);
 }
Example #7
0
 @Test
 public void testRemovePet() throws Exception {
   assertEquals(myClinic.findById(2).getPets().size(), 2);
   myClinic.removePet(2, "Bull");
   assertEquals(myClinic.findById(2).getPets().size(), 1);
 }
Example #8
0
  @Test
  public void testChangePetName() throws Exception {
    myClinic.changePetName(2, "Pushok", "Snezhok");

    assertEquals(myClinic.findById(2).getPets().get(0).getName(), "Snezhok");
  }
Example #9
0
  @Test
  public void testChangeClientName() throws Exception {
    myClinic.changeClientName(1, "Fedor");

    assertEquals(myClinic.findById(1).getClientName(), "Fedor");
  }
Example #10
0
 @Test
 public void testAddPetForClient() throws Exception {
   assertFalse(myClinic.findById(1).getPets().isEmpty());
 }
Example #11
0
 @Test
 public void testAddClient() throws Exception {
   assertFalse(myClinic.isEmpty());
 }
Example #12
0
 @Test
 public void testIsEmpty() throws Exception {
   myClinic.removeAll();
   assertTrue(myClinic.isEmpty());
 }