@Test public void testEquality() { Group g1 = new Group(); Group g2 = new Group(); assertTrue("null == null", g1.equals(g2)); g1 = new Group("name"); g2 = new Group("other"); assertFalse("\"name\" != \"other\"", g1.equals(g2)); g1 = new Group("name"); g2 = new Group("NAME"); assertTrue("\"name\" == \"NAME\"", g1.equals(g2)); assertTrue("\"name\" == \"name\"", g1.equals(g1)); assertTrue("\"NAME\" == \"NAME\"", g2.equals(g2)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Group other = (Group) obj; int numNull = (name == null ? 1 : 0) + (other.name == null ? 1 : 0); switch (numNull) { case 0: return name.toUpperCase(Locale.ROOT).equals( other.name.toUpperCase(Locale.ROOT)); case 1: return false; default: return true; } }
Group implements Comparable<Group>, Nameable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Group other = (Group) obj; int numNull = (name == null ? 1 : 0) + (other.name == null ? 1 : 0); switch (numNull) { case 0: return name.toUpperCase(Locale.ROOT).equals( other.name.toUpperCase(Locale.ROOT)); case 1: return false; default: return true; } } }
Group implements Comparable<Group>, Nameable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Group other = (Group) obj; int numNull = (name == null ? 1 : 0) + (other.name == null ? 1 : 0); switch (numNull) { case 0: return name.toUpperCase(Locale.ROOT).equals( other.name.toUpperCase(Locale.ROOT)); case 1: return false; default: return true; } } Group();  Group(String name);  Group(String name, String pattern); }
Group implements Comparable<Group>, Nameable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Group other = (Group) obj; int numNull = (name == null ? 1 : 0) + (other.name == null ? 1 : 0); switch (numNull) { case 0: return name.toUpperCase(Locale.ROOT).equals( other.name.toUpperCase(Locale.ROOT)); case 1: return false; default: return true; } } Group();  Group(String name);  Group(String name, String pattern); Set<Project> getProjects(); void addProject(Project p); void addRepository(Project p); Set<Group> getDescendants(); void setDescendants(Set<Group> descendants); void addDescendant(Group g); void removeDescendant(Group g); Set<Project> getRepositories(); void setSubgroups(Set<Group> subgroups); void setProjects(Set<Project> projects); void setRepositories(Set<Project> repositories); Set<Group> getSubgroups(); void addGroup(Group g); Set<Group> getParents(); Set<Group> getRelatedGroups(); Set<Project> getAllProjects(); Group getParent(); void setParent(Group parent); @Override String getName(); @Override void setName(String name); String getPattern(); final void setPattern(String pattern); int getFlag(); void setFlag(int flag); boolean match(Project p); @Override int compareTo(Group o); @Override int hashCode(); @Override boolean equals(Object obj); static Group getByName(String name); static Set<Group> matching(Project project, Set<Group> groups); }
Group implements Comparable<Group>, Nameable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Group other = (Group) obj; int numNull = (name == null ? 1 : 0) + (other.name == null ? 1 : 0); switch (numNull) { case 0: return name.toUpperCase(Locale.ROOT).equals( other.name.toUpperCase(Locale.ROOT)); case 1: return false; default: return true; } } Group();  Group(String name);  Group(String name, String pattern); Set<Project> getProjects(); void addProject(Project p); void addRepository(Project p); Set<Group> getDescendants(); void setDescendants(Set<Group> descendants); void addDescendant(Group g); void removeDescendant(Group g); Set<Project> getRepositories(); void setSubgroups(Set<Group> subgroups); void setProjects(Set<Project> projects); void setRepositories(Set<Project> repositories); Set<Group> getSubgroups(); void addGroup(Group g); Set<Group> getParents(); Set<Group> getRelatedGroups(); Set<Project> getAllProjects(); Group getParent(); void setParent(Group parent); @Override String getName(); @Override void setName(String name); String getPattern(); final void setPattern(String pattern); int getFlag(); void setFlag(int flag); boolean match(Project p); @Override int compareTo(Group o); @Override int hashCode(); @Override boolean equals(Object obj); static Group getByName(String name); static Set<Group> matching(Project project, Set<Group> groups);  }