User implements Comparable<User> { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final User user = (User) o; return code == user.code; } User(final String nick, final int code); void reset(); boolean isMe(); void setMe(final boolean me); int getCode(); String getNick(); void setNick(final String nick); long getLastIdle(); void setLastIdle(final long lastIdle); boolean isAway(); void setAway(final boolean away); String getAwayMsg(); void setAwayMsg(final String awayMsg); boolean isWriting(); void setWriting(final boolean writing); String getIpAddress(); void setIpAddress(final String ipAddress); String getOperatingSystem(); void setOperatingSystem(final String operatingSystem); long getLogonTime(); void setLogonTime(final long logonTime); String getClient(); void setClient(final String client); @Nullable PrivateChatWindow getPrivchat(); void setPrivchat(final PrivateChatWindow privchat); boolean isNewMsg(); void setNewMsg(final boolean newMsg); int getPrivateChatPort(); void setPrivateChatPort(final int privateChatPort); int getTcpChatPort(); void setTcpChatPort(final int tcpChatPort); boolean isTcpEnabled(); void setTcpEnabled(final boolean tcpEnabled); boolean isOnline(); void setOnline(final boolean online); boolean isNewPrivMsg(); void setNewPrivMsg(final boolean newPrivMsg); @Nullable String getHostName(); void setHostName(final String hostName); ChatLogger getPrivateChatLogger(); void setPrivateChatLogger(final ChatLogger privateChatLogger); @Override String toString(); @Override int compareTo(final User compNick); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test @SuppressWarnings({ "ObjectEqualsNull", "EqualsBetweenInconvertibleTypes" }) public void equalsShouldBeFalseWhenWrongObjects() { final User test1 = new User("Test1", 123); assertFalse(test1.equals(null)); assertFalse(test1.equals("No user")); }