@Test public void testEquals() { TransportConfiguration configuration = new TransportConfiguration("SomeClass", new HashMap<String, Object>(), null); TransportConfiguration configuration2 = new TransportConfiguration("SomeClass", new HashMap<String, Object>(), null); Assert.assertEquals(configuration, configuration2); Assert.assertEquals(configuration.hashCode(), configuration2.hashCode()); HashMap<String, Object> configMap1 = new HashMap<>(); configMap1.put("host", "localhost"); HashMap<String, Object> configMap2 = new HashMap<>(); configMap2.put("host", "localhost"); System.out.println("Equals::" + configMap1.equals(configMap2)); configuration = new TransportConfiguration("SomeClass", configMap1, null); configuration2 = new TransportConfiguration("SomeClass", configMap2, null); Assert.assertEquals(configuration, configuration2); Assert.assertEquals(configuration.hashCode(), configuration2.hashCode()); System.out.println("Equals::" + configMap1.equals(configMap2)); configuration = new TransportConfiguration("SomeClass", configMap1, "name1"); configuration2 = new TransportConfiguration("SomeClass", configMap2, "name2"); Assert.assertNotEquals(configuration, configuration2); Assert.assertNotEquals(configuration.hashCode(), configuration2.hashCode()); Assert.assertTrue(configuration.isEquivalent(configuration2)); configMap1 = new HashMap<>(); configMap1.put("host", "localhost"); configMap2 = new HashMap<>(); configMap2.put("host", "localhost3"); configuration = new TransportConfiguration("SomeClass", configMap1, null); configuration2 = new TransportConfiguration("SomeClass", configMap2, null); Assert.assertNotEquals(configuration, configuration2); Assert.assertNotEquals(configuration.hashCode(), configuration2.hashCode()); }