Package org.springframework.samples.petclinic

Examples of org.springframework.samples.petclinic.Owner


    owners = this.clinic.findOwners("Schultz");
    assertEquals(found + 1, owners.size());
  }

  public void testUpdateOwner() throws Exception {
    Owner o1 = this.clinic.loadOwner(1);
    String old = o1.getLastName();
    o1.setLastName(old + "X");
    this.clinic.storeOwner(o1);
    o1 = this.clinic.loadOwner(1);
    assertEquals(old + "X", o1.getLastName());
  }
View Full Code Here


    assertEquals(EntityUtils.getById(types, PetType.class, 4).getId(), p6.getType().getId());
    assertEquals("Peter", p6.getOwner().getFirstName());
  }

  public void testInsertPet() {
    Owner o6 = this.clinic.loadOwner(6);
    int found = o6.getPets().size();
    Pet pet = new Pet();
    pet.setName("bowser");
    Collection<PetType> types = this.clinic.getPetTypes();
    pet.setType(EntityUtils.getById(types, PetType.class, 2));
    pet.setBirthDate(new Date());
    o6.addPet(pet);
    assertEquals(found + 1, o6.getPets().size());
    this.clinic.storeOwner(o6);
    // assertTrue(!pet.isNew()); -- NOT TRUE FOR TOPLINK (before commit)
    o6 = this.clinic.loadOwner(6);
    assertEquals(found + 1, o6.getPets().size());
  }
View Full Code Here

TOP

Related Classes of org.springframework.samples.petclinic.Owner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.