@Test
 public void testEqualsWithFields() {
   Project thatProject = buildProject();
   assertTrue(project.equals(thatProject));
   thatProject.setShortName(null);
   assertFalse(project.equals(thatProject));
   project.setShortName(null);
   assertTrue(project.equals(thatProject));
 }
Exemple #2
0
 @Override
 public boolean equals(Object obj) {
   boolean result = false;
   if (this == obj) result = true;
   else if (obj == null) result = false;
   else if (getClass() != obj.getClass()) result = false;
   else if (obj instanceof Topic) {
     Topic other = (Topic) obj;
     result =
         (title.equals(other.getTitle())
             && date.equals(other.getDate())
             && description.equals(other.getDescription())
             && user.equals(other.getUser())
             && proposals.equals(other.getProposals())
             && project.equals(other.getProject()));
   }
   return result;
 }
  private void assertNotEqual() {
    assertFalse(message, project.equals(compareTo));

    validateHashCodeWhenNotEqual();
  }
Exemple #4
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   Issue other = (Issue) obj;
   if (assignee == null) {
     if (other.assignee != null) {
       return false;
     }
   } else if (!assignee.equals(other.assignee)) {
     return false;
   }
   if (author == null) {
     if (other.author != null) {
       return false;
     }
   } else if (!author.equals(other.author)) {
     return false;
   }
   if (createdOn == null) {
     if (other.createdOn != null) {
       return false;
     }
   } else if (!createdOn.equals(other.createdOn)) {
     return false;
   }
   if (customFields == null) {
     if (other.customFields != null) {
       return false;
     }
   } else if (!customFields.equals(other.customFields)) {
     return false;
   }
   if (description == null) {
     if (other.description != null) {
       return false;
     }
   } else if (!description.equals(other.description)) {
     return false;
   }
   if (doneRatio == null) {
     if (other.doneRatio != null) {
       return false;
     }
   } else if (!doneRatio.equals(other.doneRatio)) {
     return false;
   }
   if (dueDate == null) {
     if (other.dueDate != null) {
       return false;
     }
   } else if (!dueDate.equals(other.dueDate)) {
     return false;
   }
   if (estimatedHours == null) {
     if (other.estimatedHours != null) {
       return false;
     }
   } else if (!estimatedHours.equals(other.estimatedHours)) {
     return false;
   }
   if (id == null) {
     if (other.id != null) {
       return false;
     }
   } else if (!id.equals(other.id)) {
     return false;
   }
   if (journals == null) {
     if (other.journals != null) {
       return false;
     }
   } else if (!journals.equals(other.journals)) {
     return false;
   }
   if (notes == null) {
     if (other.notes != null) {
       return false;
     }
   } else if (!notes.equals(other.notes)) {
     return false;
   }
   if (parentId == null) {
     if (other.parentId != null) {
       return false;
     }
   } else if (!parentId.equals(other.parentId)) {
     return false;
   }
   if (priorityId == null) {
     if (other.priorityId != null) {
       return false;
     }
   } else if (!priorityId.equals(other.priorityId)) {
     return false;
   }
   if (priorityText == null) {
     if (other.priorityText != null) {
       return false;
     }
   } else if (!priorityText.equals(other.priorityText)) {
     return false;
   }
   if (project == null) {
     if (other.project != null) {
       return false;
     }
   } else if (!project.equals(other.project)) {
     return false;
   }
   if (relations == null) {
     if (other.relations != null) {
       return false;
     }
   } else if (!relations.equals(other.relations)) {
     return false;
   }
   if (spentHours == null) {
     if (other.spentHours != null) {
       return false;
     }
   } else if (!spentHours.equals(other.spentHours)) {
     return false;
   }
   if (startDate == null) {
     if (other.startDate != null) {
       return false;
     }
   } else if (!startDate.equals(other.startDate)) {
     return false;
   }
   if (statusId == null) {
     if (other.statusId != null) {
       return false;
     }
   } else if (!statusId.equals(other.statusId)) {
     return false;
   }
   if (statusName == null) {
     if (other.statusName != null) {
       return false;
     }
   } else if (!statusName.equals(other.statusName)) {
     return false;
   }
   if (subject == null) {
     if (other.subject != null) {
       return false;
     }
   } else if (!subject.equals(other.subject)) {
     return false;
   }
   if (tracker == null) {
     if (other.tracker != null) {
       return false;
     }
   } else if (!tracker.equals(other.tracker)) {
     return false;
   }
   if (updatedOn == null) {
     if (other.updatedOn != null) {
       return false;
     }
   } else if (!updatedOn.equals(other.updatedOn)) {
     return false;
   }
   if (attachments == null) {
     if (other.attachments != null) {
       return false;
     }
   } else if (!attachments.equals(other.attachments)) {
     return false;
   }
   return true;
 }
 @Test
 public void testEqualsWithAnotherClass() {
   assertFalse(project.equals(new String(NAME)));
 }
 @Test
 public void testEqualsWithNull() {
   assertFalse(project.equals(null));
 }
 @Test
 public void testEqualsWithOneProject() {
   assertTrue(project.equals(project));
 }