@Test public void testEquals() { Exercise exercise2 = new Exercise("testname2", "testcourse"); Project p = new Project(exercise2, projectFiles); assertFalse(p.equals(project)); assertFalse(project.equals(p)); p.setExercise(exercise); assertTrue(p.equals(project)); p.setExercise(new Exercise()); assertFalse(p.equals(project)); assertFalse(project.equals("asdasd")); assertFalse(project.equals(null)); }
@Override public boolean equals(Object o) { if (o == null || !(o instanceof Project)) { return false; } Project p = (Project) o; if (this.exercise == null || p.exercise == null) { return false; } return this.exercise.equals(p.exercise); }
Project { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Project)) { return false; } Project p = (Project) o; if (this.exercise == null || p.exercise == null) { return false; } return this.exercise.equals(p.exercise); } }
Project { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Project)) { return false; } Project p = (Project) o; if (this.exercise == null || p.exercise == null) { return false; } return this.exercise.equals(p.exercise); } Project(Exercise exercise);  Project(Exercise exercise, List<String> projectFiles); }
Project { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Project)) { return false; } Project p = (Project) o; if (this.exercise == null || p.exercise == null) { return false; } return this.exercise.equals(p.exercise); } Project(Exercise exercise);  Project(Exercise exercise, List<String> projectFiles); Exercise getExercise(); void setExercise(Exercise exercise); String getRootPath(); ProjectType getProjectType(); boolean containsFile(String file); @Override boolean equals(Object o); @Override int hashCode(); ZippingDecider getZippingDecider(); void setProjectFiles(List<String> files); List<String> getReadOnlyProjectFiles(); String getProjectFileByName(String fileName); void addProjectFile(String file); void removeProjectFile(String path); void setExtraStudentFiles(List<String> files); List<String> getExtraStudentFiles(); boolean existsOnDisk(); ProjectStatus getStatus(); void setStatus(ProjectStatus status); }
Project { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Project)) { return false; } Project p = (Project) o; if (this.exercise == null || p.exercise == null) { return false; } return this.exercise.equals(p.exercise); } Project(Exercise exercise);  Project(Exercise exercise, List<String> projectFiles); Exercise getExercise(); void setExercise(Exercise exercise); String getRootPath(); ProjectType getProjectType(); boolean containsFile(String file); @Override boolean equals(Object o); @Override int hashCode(); ZippingDecider getZippingDecider(); void setProjectFiles(List<String> files); List<String> getReadOnlyProjectFiles(); String getProjectFileByName(String fileName); void addProjectFile(String file); void removeProjectFile(String path); void setExtraStudentFiles(List<String> files); List<String> getExtraStudentFiles(); boolean existsOnDisk(); ProjectStatus getStatus(); void setStatus(ProjectStatus status);  }