@Test public void testEquals() { AdaptorConfig conf1 = new AdaptorConfig("a", "b", "c", "d"); AdaptorConfig conf2 = new AdaptorConfig("a", "b", "c", "d"); AdaptorConfig conf3 = new AdaptorConfig("a1", "b1", "c1", "d1"); Assert.assertEquals(conf1, conf2); Assert.assertEquals(conf1.hashCode(), conf2.hashCode()); Assert.assertNotSame(conf1, conf2); Assert.assertNotEquals(conf1, conf3); Assert.assertNotEquals(conf1.hashCode(), conf3.hashCode()); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AdaptorConfig that = (AdaptorConfig) o; if (poolMaxIdle != that.poolMaxIdle) return false; if (poolMaxTotal != that.poolMaxTotal) return false; if (poolMinIdle != that.poolMinIdle) return false; if (!url.equals(that.url)) return false; if (!driver.equals(that.driver)) return false; if (!username.equals(that.username)) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; return datasourceId != null ? datasourceId.equals(that.datasourceId) : that.datasourceId == null; }
AdaptorConfig { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AdaptorConfig that = (AdaptorConfig) o; if (poolMaxIdle != that.poolMaxIdle) return false; if (poolMaxTotal != that.poolMaxTotal) return false; if (poolMinIdle != that.poolMinIdle) return false; if (!url.equals(that.url)) return false; if (!driver.equals(that.driver)) return false; if (!username.equals(that.username)) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; return datasourceId != null ? datasourceId.equals(that.datasourceId) : that.datasourceId == null; } }
AdaptorConfig { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AdaptorConfig that = (AdaptorConfig) o; if (poolMaxIdle != that.poolMaxIdle) return false; if (poolMaxTotal != that.poolMaxTotal) return false; if (poolMinIdle != that.poolMinIdle) return false; if (!url.equals(that.url)) return false; if (!driver.equals(that.driver)) return false; if (!username.equals(that.username)) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; return datasourceId != null ? datasourceId.equals(that.datasourceId) : that.datasourceId == null; } AdaptorConfig(String url, String driver, String username, String password); }
AdaptorConfig { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AdaptorConfig that = (AdaptorConfig) o; if (poolMaxIdle != that.poolMaxIdle) return false; if (poolMaxTotal != that.poolMaxTotal) return false; if (poolMinIdle != that.poolMinIdle) return false; if (!url.equals(that.url)) return false; if (!driver.equals(that.driver)) return false; if (!username.equals(that.username)) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; return datasourceId != null ? datasourceId.equals(that.datasourceId) : that.datasourceId == null; } AdaptorConfig(String url, String driver, String username, String password); @Override boolean equals(Object o); @Override int hashCode(); }
AdaptorConfig { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AdaptorConfig that = (AdaptorConfig) o; if (poolMaxIdle != that.poolMaxIdle) return false; if (poolMaxTotal != that.poolMaxTotal) return false; if (poolMinIdle != that.poolMinIdle) return false; if (!url.equals(that.url)) return false; if (!driver.equals(that.driver)) return false; if (!username.equals(that.username)) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; return datasourceId != null ? datasourceId.equals(that.datasourceId) : that.datasourceId == null; } AdaptorConfig(String url, String driver, String username, String password); @Override boolean equals(Object o); @Override int hashCode(); final String url; final String driver; final String username; final String password; public String datasourceId; public int poolMaxIdle; public int poolMaxTotal; public int poolMinIdle; }