Record { @Override public int hashCode() { int result = 17; result = 31 * result + (name == null ? 0 : name.hashCode()); result = 31 * result + (type == null ? 0 : type.hashCode()); result = 31 * result + (location == null ? 0 : location.hashCode()); result = 31 * result + (metadata == null ? 0 : metadata.hashCode()); result = 31 * result + (registration == null ? 0 : registration.hashCode()); result = 31 * result + (status == null ? 0 : status.hashCode()); return result; } Record();  Record(JsonObject json);  Record(Record other); JsonObject toJson(); JsonObject getLocation(); Record setLocation(JsonObject location); JsonObject getMetadata(); Record setMetadata(JsonObject metadata); String getName(); Record setName(String name); Status getStatus(); Record setStatus(Status status); Record setRegistration(String reg); String getRegistration(); String getType(); Record setType(String type); boolean match(JsonObject filter); @Override boolean equals(Object o); @Override int hashCode(); static final String ENDPOINT; }
@Test public void testReferenceEqualityAndHashcode() { String recordJson = " {\n" + " \"name\": \"theServiceDiscovery\",\n" + " \"type\": \"theServiceType\",\n" + " \"location\": {},\n" + " \"metadata\": {},\n" + " \"registration\": \"theUUID\",\n" + " \"status\": \"UNKNOWN\"\n" + " }"; Record record1 = new Record(new JsonObject(recordJson)); Record record2 = new Record(new JsonObject(recordJson)); Assertions.assertThat(record1).isEqualTo(record2); Assertions.assertThat(record1.hashCode()).isEqualTo(record2.hashCode()); }