コード例 #1
0
  @Test
  public void testEqualsObject() {

    assertTrue(
        "Test Address Order 1 and 2 should equal each other",
        TestDepartmentObject1.equals(TestDepartmentObject2));
    assertFalse(
        "Test Address Order 1 and 3 should not equal each other - Id",
        TestDepartmentObject1.equals(TestDepartmentObject3));
    assertFalse(
        "Test Address Order 1 and 4 should not equal each other - Name",
        TestDepartmentObject1.equals(TestDepartmentObject4));
    assertFalse(
        "Test Address Order 1 and 5 should not equal each other - Chair",
        TestDepartmentObject1.equals(TestDepartmentObject5));
  }
コード例 #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if ((obj instanceof LargeMailUser) == false) {
     return false;
   }
   LargeMailUser other = ((LargeMailUser) obj);
   if (addressLine == null) {
     if (other.addressLine != null) {
       return false;
     }
   } else {
     if (addressLine.equals(other.addressLine) == false) {
       return false;
     }
   }
   if (largeMailUserName == null) {
     if (other.largeMailUserName != null) {
       return false;
     }
   } else {
     if (largeMailUserName.equals(other.largeMailUserName) == false) {
       return false;
     }
   }
   if (largeMailUserIdentifier == null) {
     if (other.largeMailUserIdentifier != null) {
       return false;
     }
   } else {
     if (largeMailUserIdentifier.equals(other.largeMailUserIdentifier) == false) {
       return false;
     }
   }
   if (buildingName == null) {
     if (other.buildingName != null) {
       return false;
     }
   } else {
     if (buildingName.equals(other.buildingName) == false) {
       return false;
     }
   }
   if (department == null) {
     if (other.department != null) {
       return false;
     }
   } else {
     if (department.equals(other.department) == false) {
       return false;
     }
   }
   if (postBox == null) {
     if (other.postBox != null) {
       return false;
     }
   } else {
     if (postBox.equals(other.postBox) == false) {
       return false;
     }
   }
   if (thoroughfare == null) {
     if (other.thoroughfare != null) {
       return false;
     }
   } else {
     if (thoroughfare.equals(other.thoroughfare) == false) {
       return false;
     }
   }
   if (postalCode == null) {
     if (other.postalCode != null) {
       return false;
     }
   } else {
     if (postalCode.equals(other.postalCode) == false) {
       return false;
     }
   }
   if (any == null) {
     if (other.any != null) {
       return false;
     }
   } else {
     if (any.equals(other.any) == false) {
       return false;
     }
   }
   if (underscore == null) {
     if (other.underscore != null) {
       return false;
     }
   } else {
     if (underscore.equals(other.underscore) == false) {
       return false;
     }
   }
   return true;
 }