### Question:
AdminServer extends Server { public AdminService createAdminService() { if (adminService == null) { adminService = new AdminService(); } return adminService; }  AdminServer withChannel(String channelName, int nodePort); List<String> getChannelNames(); List<Channel> getChannels(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); AdminService createAdminService(); AdminService getAdminService();  }### Answer:
@Test public void whenHaveSameAdminServiceLabels_objectsAreEqual() { server1.createAdminService().withServiceLabel(NAME1, VALUE1).withServiceLabel(NAME2, VALUE2); server2.createAdminService().withServiceLabel(NAME2, VALUE2).withServiceLabel(NAME1, VALUE1); assertThat(server1, equalTo(server2)); }
@Test public void whenHaveDifferentAdminServiceLabels_objectsAreNotEqual() { server1.createAdminService().withServiceLabel(NAME1, VALUE1).withServiceLabel(NAME2, VALUE2); server2.createAdminService().withServiceLabel(NAME1, VALUE2).withServiceLabel(NAME2, VALUE1); assertThat(server1, not(equalTo(server2))); }
@Test public void whenHaveSameAdminServiceAnnotations_objectsAreEqual() { server1 .createAdminService() .withServiceAnnotation(NAME1, VALUE1) .withServiceAnnotation(NAME2, VALUE2); server2 .createAdminService() .withServiceAnnotation(NAME2, VALUE2) .withServiceAnnotation(NAME1, VALUE1); assertThat(server1, equalTo(server2)); }
@Test public void whenHaveDifferentAdminServiceAnnotations_objectsAreNotEqual() { server1 .createAdminService() .withServiceAnnotation(NAME1, VALUE1) .withServiceAnnotation(NAME2, VALUE2); server2 .createAdminService() .withServiceAnnotation(NAME1, VALUE2) .withServiceAnnotation(NAME2, VALUE1); assertThat(server1, not(equalTo(server2))); }