@Test public void equals_different() { final BrowserType type1 = new BrowserType(1, "Email client"); final BrowserType type2 = new BrowserType(2, "Email client"); assertThat(type1.equals(type2)).isFalse(); final BrowserType type3 = new BrowserType(1, "Browser"); final BrowserType type4 = new BrowserType(1, "Email client"); assertThat(type3.equals(type4)).isFalse(); final BrowserType type5 = new BrowserType(1, "Browser"); final String type6 = ""; assertThat(type5.equals(type6)).isFalse(); final BrowserType type7 = new BrowserType(1, "Browser"); final BrowserType type8 = null; assertThat(type7.equals(type8)).isFalse(); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BrowserType other = (BrowserType) obj; if (id != other.id) { return false; } if (!name.equals(other.name)) { return false; } return true; }
BrowserType implements Identifiable, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BrowserType other = (BrowserType) obj; if (id != other.id) { return false; } if (!name.equals(other.name)) { return false; } return true; } }
BrowserType implements Identifiable, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BrowserType other = (BrowserType) obj; if (id != other.id) { return false; } if (!name.equals(other.name)) { return false; } return true; } BrowserType(@Nonnegative final int id, @Nonnull final String name); }
BrowserType implements Identifiable, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BrowserType other = (BrowserType) obj; if (id != other.id) { return false; } if (!name.equals(other.name)) { return false; } return true; } BrowserType(@Nonnegative final int id, @Nonnull final String name); @Override boolean equals(final Object obj); @Override int getId(); String getName(); @Override int hashCode(); @Override String toString(); }
BrowserType implements Identifiable, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BrowserType other = (BrowserType) obj; if (id != other.id) { return false; } if (!name.equals(other.name)) { return false; } return true; } BrowserType(@Nonnegative final int id, @Nonnull final String name); @Override boolean equals(final Object obj); @Override int getId(); String getName(); @Override int hashCode(); @Override String toString();  }