diff --git a/.project b/.project
new file mode 100644
index 0000000..3c71292
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+
+
+ spring-petclinic
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..839d647
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding/=UTF-8
diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..d4313d4
--- /dev/null
+++ b/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..cf4d3d8
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/src/main/java/org/springframework/samples/petclinic/model/Pet.java b/src/main/java/org/springframework/samples/petclinic/model/MyPet.java
similarity index 91%
rename from src/main/java/org/springframework/samples/petclinic/model/Pet.java
rename to src/main/java/org/springframework/samples/petclinic/model/MyPet.java
index 4bc2b92..348ec25 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/Pet.java
+++ b/src/main/java/org/springframework/samples/petclinic/model/MyPet.java
@@ -45,7 +45,7 @@
*/
@Entity
@Table(name = "pets")
-public class Pet extends NamedEntity {
+public class MyPet extends NamedEntity {
@Column(name = "birth_date")
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
@@ -61,7 +61,7 @@ public class Pet extends NamedEntity {
private Owner owner;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
- private Set visits;
+ private Set visitsInternal;
public void setBirthDate(DateTime birthDate) {
@@ -89,14 +89,14 @@ public Owner getOwner() {
}
protected void setVisitsInternal(Set visits) {
- this.visits = visits;
+ this.visitsInternal = visits;
}
protected Set getVisitsInternal() {
- if (this.visits == null) {
- this.visits = new HashSet();
+ if (this.visitsInternal == null) {
+ this.visitsInternal = new HashSet();
}
- return this.visits;
+ return this.visitsInternal;
}
public List getVisits() {
diff --git a/src/main/java/org/springframework/samples/petclinic/model/Owner.java b/src/main/java/org/springframework/samples/petclinic/model/Owner.java
index 840a965..18fddd0 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/Owner.java
+++ b/src/main/java/org/springframework/samples/petclinic/model/Owner.java
@@ -58,7 +58,7 @@ public class Owner extends Person {
private String telephone;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- private Set pets;
+ private Set pets;
public String getAddress() {
@@ -85,24 +85,25 @@ public void setTelephone(String telephone) {
this.telephone = telephone;
}
- protected void setPetsInternal(Set pets) {
+ protected void setPetsInternal(Set pets) {
this.pets = pets;
}
- protected Set getPetsInternal() {
+ protected Set getPetsInternal() {
if (this.pets == null) {
- this.pets = new HashSet();
+ this.pets = new HashSet();
}
return this.pets;
}
- public List getPets() {
- List sortedPets = new ArrayList(getPetsInternal());
+ public List getPets() {
+ List sortedPets = new ArrayList(getPetsInternal());
+ System.out.println(sortedPets);
PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
return Collections.unmodifiableList(sortedPets);
}
- public void addPet(Pet pet) {
+ public void addPet(MyPet pet) {
getPetsInternal().add(pet);
pet.setOwner(this);
}
@@ -113,7 +114,7 @@ public void addPet(Pet pet) {
* @param name to test
* @return true if pet name is already in use
*/
- public Pet getPet(String name) {
+ public MyPet getPet(String name) {
return getPet(name, false);
}
@@ -123,9 +124,9 @@ public Pet getPet(String name) {
* @param name to test
* @return true if pet name is already in use
*/
- public Pet getPet(String name, boolean ignoreNew) {
+ public MyPet getPet(String name, boolean ignoreNew) {
name = name.toLowerCase();
- for (Pet pet : getPetsInternal()) {
+ for (MyPet pet : getPetsInternal()) {
if (!ignoreNew || !pet.isNew()) {
String compName = pet.getName();
compName = compName.toLowerCase();
diff --git a/src/main/java/org/springframework/samples/petclinic/model/Visit.java b/src/main/java/org/springframework/samples/petclinic/model/Visit.java
index ea03bde..42bc86d 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/Visit.java
+++ b/src/main/java/org/springframework/samples/petclinic/model/Visit.java
@@ -55,7 +55,7 @@ public class Visit extends BaseEntity {
*/
@ManyToOne
@JoinColumn(name = "pet_id")
- private Pet pet;
+ private MyPet pet;
/**
@@ -107,7 +107,7 @@ public void setDescription(String description) {
*
* @return Value of property pet.
*/
- public Pet getPet() {
+ public MyPet getPet() {
return this.pet;
}
@@ -116,7 +116,7 @@ public Pet getPet() {
*
* @param pet New value of property pet.
*/
- public void setPet(Pet pet) {
+ public void setPet(MyPet pet) {
this.pet = pet;
}
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java
index 693b2e5..dc8f7aa 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java
@@ -19,7 +19,7 @@
import org.springframework.dao.DataAccessException;
import org.springframework.samples.petclinic.model.BaseEntity;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
/**
@@ -48,7 +48,7 @@ public interface PetRepository {
* @throws org.springframework.dao.DataRetrievalFailureException
* if not found
*/
- Pet findById(int id) throws DataAccessException;
+ MyPet findById(int id) throws DataAccessException;
/**
* Save a Pet to the data store, either inserting or updating it.
@@ -56,6 +56,6 @@ public interface PetRepository {
* @param pet the Pet to save
* @see BaseEntity#isNew
*/
- void save(Pet pet) throws DataAccessException;
+ void save(MyPet pet) throws DataAccessException;
}
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java
index 75e55a4..5bd791a 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java
@@ -31,7 +31,7 @@
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.model.Visit;
import org.springframework.samples.petclinic.repository.OwnerRepository;
@@ -74,7 +74,7 @@ public JdbcOwnerRepositoryImpl(DataSource dataSource, NamedParameterJdbcTemplate
/**
* Loads {@link Owner Owners} from the data store by last name, returning all owners whose last name starts with
- * the given name; also loads the {@link Pet Pets} and {@link Visit Visits} for the corresponding owners, if not
+ * the given name; also loads the {@link MyPet Pets} and {@link Visit Visits} for the corresponding owners, if not
* already loaded.
*/
@Override
@@ -91,7 +91,7 @@ public Collection findByLastName(String lastName) throws DataAccessExcept
}
/**
- * Loads the {@link Owner} with the supplied id; also loads the {@link Pet Pets} and {@link Visit Visits}
+ * Loads the {@link Owner} with the supplied id; also loads the {@link MyPet Pets} and {@link Visit Visits}
* for the corresponding owner, if not already loaded.
*/
@Override
@@ -151,7 +151,7 @@ public Collection getPetTypes() throws DataAccessException {
}
/**
- * Loads the {@link Pet} and {@link Visit} data for the supplied {@link List} of {@link Owner Owners}.
+ * Loads the {@link MyPet} and {@link Visit} data for the supplied {@link List} of {@link Owner Owners}.
*
* @param owners the list of owners for whom the pet and visit data should be loaded
* @see #loadPetsAndVisits(Owner)
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPet.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPet.java
index f2ed258..39d1d57 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPet.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPet.java
@@ -15,7 +15,7 @@
*/
package org.springframework.samples.petclinic.repository.jdbc;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
/**
* Subclass of Pet that carries temporary id properties which are only relevant for a JDBC implementation of the
@@ -23,7 +23,7 @@
*
* @author Juergen Hoeller
*/
-class JdbcPet extends Pet {
+class JdbcPet extends MyPet {
private int typeId;
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java
index c594ead..9efc034 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java
@@ -30,7 +30,7 @@
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.model.Visit;
import org.springframework.samples.petclinic.repository.OwnerRepository;
@@ -81,7 +81,7 @@ public List findPetTypes() throws DataAccessException {
}
@Override
- public Pet findById(int id) throws DataAccessException {
+ public MyPet findById(int id) throws DataAccessException {
JdbcPet pet;
try {
Map params = new HashMap();
@@ -91,7 +91,7 @@ public Pet findById(int id) throws DataAccessException {
params,
new JdbcPetRowMapper());
} catch (EmptyResultDataAccessException ex) {
- throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
+ throw new ObjectRetrievalFailureException(MyPet.class, new Integer(id));
}
Owner owner = this.ownerRepository.findById(pet.getOwnerId());
owner.addPet(pet);
@@ -105,7 +105,7 @@ public Pet findById(int id) throws DataAccessException {
}
@Override
- public void save(Pet pet) throws DataAccessException {
+ public void save(MyPet pet) throws DataAccessException {
if (pet.isNew()) {
Number newKey = this.insertPet.executeAndReturnKey(
createPetParameterSource(pet));
@@ -119,9 +119,9 @@ public void save(Pet pet) throws DataAccessException {
}
/**
- * Creates a {@link MapSqlParameterSource} based on data values from the supplied {@link Pet} instance.
+ * Creates a {@link MapSqlParameterSource} based on data values from the supplied {@link MyPet} instance.
*/
- private MapSqlParameterSource createPetParameterSource(Pet pet) {
+ private MapSqlParameterSource createPetParameterSource(MyPet pet) {
return new MapSqlParameterSource()
.addValue("id", pet.getId())
.addValue("name", pet.getName())
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java
index 84d564d..b7aaaa0 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java
@@ -20,7 +20,7 @@
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.repository.PetRepository;
import org.springframework.stereotype.Repository;
@@ -47,12 +47,12 @@ public List findPetTypes() {
}
@Override
- public Pet findById(int id) {
- return this.em.find(Pet.class, id);
+ public MyPet findById(int id) {
+ return this.em.find(MyPet.class, id);
}
@Override
- public void save(Pet pet) {
+ public void save(MyPet pet) {
if (pet.getId() == null) {
this.em.persist(pet);
}
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java
index 56a4131..8c8c508 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java
@@ -20,7 +20,7 @@
import org.springframework.dao.DataAccessException;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.repository.PetRepository;
@@ -30,7 +30,7 @@
* @author Michael Isvy
* @since 15.1.2013
*/
-public interface SpringDataPetRepository extends PetRepository, Repository {
+public interface SpringDataPetRepository extends PetRepository, Repository {
@Override
@Query("SELECT ptype FROM PetType ptype ORDER BY ptype.name")
diff --git a/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java b/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java
index e72b5c1..bdb0025 100644
--- a/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java
+++ b/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java
@@ -19,7 +19,7 @@
import org.springframework.dao.DataAccessException;
import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.model.Vet;
import org.springframework.samples.petclinic.model.Visit;
@@ -36,9 +36,9 @@ public interface ClinicService {
Owner findOwnerById(int id) throws DataAccessException;
- Pet findPetById(int id) throws DataAccessException;
+ MyPet findPetById(int id) throws DataAccessException;
- void savePet(Pet pet) throws DataAccessException;
+ void savePet(MyPet pet) throws DataAccessException;
void saveVisit(Visit visit) throws DataAccessException;
diff --git a/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java b/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
index 0d7ff4d..36178ab 100644
--- a/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
+++ b/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
@@ -21,7 +21,7 @@
import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DataAccessException;
import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.model.Vet;
import org.springframework.samples.petclinic.model.Visit;
@@ -88,13 +88,13 @@ public void saveVisit(Visit visit) throws DataAccessException {
@Override
@Transactional(readOnly = true)
- public Pet findPetById(int id) throws DataAccessException {
+ public MyPet findPetById(int id) throws DataAccessException {
return petRepository.findById(id);
}
@Override
@Transactional
- public void savePet(Pet pet) throws DataAccessException {
+ public void savePet(MyPet pet) throws DataAccessException {
petRepository.save(pet);
}
diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetController.java b/src/main/java/org/springframework/samples/petclinic/web/PetController.java
index ea8aeaa..2ecbc17 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/PetController.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/PetController.java
@@ -20,7 +20,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.service.ClinicService;
import org.springframework.stereotype.Controller;
@@ -64,14 +64,14 @@ public void setAllowedFields(WebDataBinder dataBinder) {
@RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.GET)
public String initCreationForm(@PathVariable("ownerId") int ownerId, Map model) {
Owner owner = this.clinicService.findOwnerById(ownerId);
- Pet pet = new Pet();
+ MyPet pet = new MyPet();
owner.addPet(pet);
model.put("pet", pet);
return "pets/createOrUpdatePetForm";
}
@RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.POST)
- public String processCreationForm(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
+ public String processCreationForm(@ModelAttribute("pet") MyPet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result);
if (result.hasErrors()) {
return "pets/createOrUpdatePetForm";
@@ -84,13 +84,13 @@ public String processCreationForm(@ModelAttribute("pet") Pet pet, BindingResult
@RequestMapping(value = "/owners/*/pets/{petId}/edit", method = RequestMethod.GET)
public String initUpdateForm(@PathVariable("petId") int petId, Map model) {
- Pet pet = this.clinicService.findPetById(petId);
+ MyPet pet = this.clinicService.findPetById(petId);
model.put("pet", pet);
return "pets/createOrUpdatePetForm";
}
@RequestMapping(value = "/owners/{ownerId}/pets/{petId}/edit", method = {RequestMethod.PUT, RequestMethod.POST})
- public String processUpdateForm(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
+ public String processUpdateForm(@ModelAttribute("pet") MyPet pet, BindingResult result, SessionStatus status) {
// we're not using @Valid annotation here because it is easier to define such validation rule in Java
new PetValidator().validate(pet, result);
if (result.hasErrors()) {
diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java b/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java
index ad1ebdf..a709a6f 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java
@@ -15,7 +15,7 @@
*/
package org.springframework.samples.petclinic.web;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
@@ -27,7 +27,7 @@
*/
public class PetValidator {
- public void validate(Pet pet, Errors errors) {
+ public void validate(MyPet pet, Errors errors) {
String name = pet.getName();
// name validaation
if (!StringUtils.hasLength(name)) {
diff --git a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java
index 4f38bd5..5f24fd9 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java
@@ -20,7 +20,7 @@
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.Visit;
import org.springframework.samples.petclinic.service.ClinicService;
import org.springframework.stereotype.Controller;
@@ -59,7 +59,7 @@ public void setAllowedFields(WebDataBinder dataBinder) {
@RequestMapping(value = "/owners/*/pets/{petId}/visits/new", method = RequestMethod.GET)
public String initNewVisitForm(@PathVariable("petId") int petId, Map model) {
- Pet pet = this.clinicService.findPetById(petId);
+ MyPet pet = this.clinicService.findPetById(petId);
Visit visit = new Visit();
pet.addVisit(visit);
model.put("visit", visit);
diff --git a/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java b/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java
index d5044fd..184472c 100644
--- a/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java
@@ -32,7 +32,7 @@ public class OwnerTests {
@Transactional
public void testHasPet() {
Owner owner = new Owner();
- Pet fido = new Pet();
+ MyPet fido = new MyPet();
fido.setName("Fido");
assertNull(owner.getPet("Fido"));
assertNull(owner.getPet("fido"));
diff --git a/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java b/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java
index 02a21ac..295f6c5 100644
--- a/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java
@@ -26,7 +26,7 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
+import org.springframework.samples.petclinic.model.MyPet;
import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.model.Vet;
import org.springframework.samples.petclinic.model.Visit;
@@ -108,11 +108,11 @@ public void updateOwner() throws Exception {
@Test
public void findPet() {
Collection types = this.clinicService.findPetTypes();
- Pet pet7 = this.clinicService.findPetById(7);
+ MyPet pet7 = this.clinicService.findPetById(7);
assertTrue(pet7.getName().startsWith("Samantha"));
assertEquals(EntityUtils.getById(types, PetType.class, 1).getId(), pet7.getType().getId());
assertEquals("Jean", pet7.getOwner().getFirstName());
- Pet pet6 = this.clinicService.findPetById(6);
+ MyPet pet6 = this.clinicService.findPetById(6);
assertEquals("George", pet6.getName());
assertEquals(EntityUtils.getById(types, PetType.class, 4).getId(), pet6.getType().getId());
assertEquals("Peter", pet6.getOwner().getFirstName());
@@ -133,7 +133,7 @@ public void getPetTypes() {
public void insertPet() {
Owner owner6 = this.clinicService.findOwnerById(6);
int found = owner6.getPets().size();
- Pet pet = new Pet();
+ MyPet pet = new MyPet();
pet.setName("bowser");
Collection types = this.clinicService.findPetTypes();
pet.setType(EntityUtils.getById(types, PetType.class, 2));
@@ -151,7 +151,7 @@ public void insertPet() {
@Test
@Transactional
public void updatePet() throws Exception {
- Pet pet7 = this.clinicService.findPetById(7);
+ MyPet pet7 = this.clinicService.findPetById(7);
String old = pet7.getName();
pet7.setName(old + "X");
this.clinicService.savePet(pet7);
@@ -177,7 +177,7 @@ public void findVets() {
@Test
@Transactional
public void insertVisit() {
- Pet pet7 = this.clinicService.findPetById(7);
+ MyPet pet7 = this.clinicService.findPetById(7);
int found = pet7.getVisits().size();
Visit visit = new Visit();
pet7.addVisit(visit);