[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/pojo/test ...

Jason Thomas Greene jgreene at jboss.com
Thu Jun 7 01:50:21 EDT 2007


  User: jgreene 
  Date: 07/06/07 01:50:21

  Modified:    tests/functional/org/jboss/cache/pojo/test  Person.java
  Log:
  Add more thorough test coverage of notifications
  
  Revision  Changes    Path
  1.3       +51 -1     JBossCache/tests/functional/org/jboss/cache/pojo/test/Person.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Person.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/test/Person.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- Person.java	16 May 2007 12:33:59 -0000	1.2
  +++ Person.java	7 Jun 2007 05:50:21 -0000	1.3
  @@ -17,7 +17,7 @@
    * Test class for PojoCache.
    * Person is a POJO that will be instrumented with CacheFieldInterceptor
    *
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *          <p>Below is the annotation that signifies this class is "prepared" under JBossAop. This is used in
    *          conjunction with a special jboss-aop.xml (supplied by PojoCache). In addition, this is JDK1.4 style,
    *          so a annoc Ant build target is needed to pre-compile it.</p>
  @@ -174,6 +174,56 @@
         return sb.toString();
      }
   
  +   private static boolean equals(Object o1, Object o2)
  +   {
  +      if (o1 == o2)
  +         return true;
  +
  +      if (o1 == null || o2 == null)
  +         return false;
  +
  +      return o1.equals(o2);
  +   }
  +
  +   public boolean equals(Object o)
  +   {
  +      if (! (o instanceof Person))
  +         return false;
  +
  +      if (o == this)
  +         return true;
  +
  +      Person other = (Person) o;
  +      return other.age == age && equals(other.name, name) && equals(other.hobbies, hobbies) && equals(other.address, address)
  +         && equals(other.skills, skills) && equals(other.languages, languages) && equals(other.currentStatus, currentStatus)
  +         && equals(other.medication, medication);
  +   }
  +
  +   public int hashCode()
  +   {
  +      int result = 629 * name.hashCode() * 37 * age;
  +
  +      if (hobbies != null)
  +         result = 37 * result + hobbies.hashCode();
  +
  +      if (address != null)
  +         result = 37 * result + address.hashCode();
  +
  +      if (skills != null)
  +         result = 37 * result + skills.hashCode();
  +
  +      if (languages != null)
  +         result = 37 * result + languages.hashCode();
  +
  +      if (currentStatus != null)
  +         result = 37 * result + currentStatus.hashCode();
  +
  +      if (medication != null)
  +         result = 37 * medication.hashCode();
  +
  +      return result;
  +   }
  +
      public String print(Map m)
      {
         StringBuffer sb = new StringBuffer();
  
  
  



More information about the jboss-cvs-commits mailing list