ResponseStatus { @Override public boolean equals(Object obj) { if (obj instanceof ResponseStatus && ((ResponseStatus) obj).getCode() == this.getCode() && ((ResponseStatus) obj).getMessage().equals(this.getMessage())) { return true; } else { return false; } } ResponseStatus(Code code);  ResponseStatus(Code code, String message); boolean isSuccess(); Code getCode(); String getMessage(); @Override boolean equals(Object obj); @Override int hashCode(); static ResponseStatus createSuccess();  }
@Test public void testEquals() { ResponseStatus status1 = new ResponseStatus(Code.AGENT_INTERNAL_ERROR, "this is a test"); ResponseStatus status2 = new ResponseStatus(Code.AGENT_INTERNAL_ERROR, "this is a test"); ResponseStatus status3 = new ResponseStatus(Code.AGENT_INTERNAL_ERROR, "hello world"); ResponseStatus status4 = new ResponseStatus(Code.INTERNAL_ERROR, "hello world"); assertEquals(status1, status2); assertNotEquals(status1, status3); assertNotEquals(status1, status4); assertNotEquals(status3, status4); }