@Test public void equals() throws Exception { ProviderInfo info1 = new ProviderInfo(); info1.setIp("0.0.0.0"); info1.setVersion(1); info1.setPort(80); info1.setName("test"); info1.setWeight(1); ProviderInfo info2 = new ProviderInfo(); info2.setIp("0.0.0.0"); info2.setVersion(1); info2.setPort(80); info2.setName("test"); info2.setWeight(1); assertEquals(info1.hashCode(), info2.hashCode()); assertTrue(info1.equals(info2)); info1.setVersion(2); assertFalse(info1.equals(info2)); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProviderInfo that = (ProviderInfo) o; if (weight != that.weight) return false; if (port != that.port) return false; if (version != that.version) return false; if (!name.equals(that.name)) return false; return ip.equals(that.ip); }
ProviderInfo { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProviderInfo that = (ProviderInfo) o; if (weight != that.weight) return false; if (port != that.port) return false; if (version != that.version) return false; if (!name.equals(that.name)) return false; return ip.equals(that.ip); } }
ProviderInfo { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProviderInfo that = (ProviderInfo) o; if (weight != that.weight) return false; if (port != that.port) return false; if (version != that.version) return false; if (!name.equals(that.name)) return false; return ip.equals(that.ip); } ProviderInfo(String name, String ip, int weight, int port, long version);  ProviderInfo(String name, String ip, int port);  ProviderInfo(String name, int port);  ProviderInfo(); }
ProviderInfo { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProviderInfo that = (ProviderInfo) o; if (weight != that.weight) return false; if (port != that.port) return false; if (version != that.version) return false; if (!name.equals(that.name)) return false; return ip.equals(that.ip); } ProviderInfo(String name, String ip, int weight, int port, long version);  ProviderInfo(String name, String ip, int port);  ProviderInfo(String name, int port);  ProviderInfo(); String getIp(); void setIp(String ip); int getPort(); void setPort(int port); int getWeight(); void setWeight(int weight); String getName(); void setName(String name); long getVersion(); void setVersion(long version); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
ProviderInfo { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProviderInfo that = (ProviderInfo) o; if (weight != that.weight) return false; if (port != that.port) return false; if (version != that.version) return false; if (!name.equals(that.name)) return false; return ip.equals(that.ip); } ProviderInfo(String name, String ip, int weight, int port, long version);  ProviderInfo(String name, String ip, int port);  ProviderInfo(String name, int port);  ProviderInfo(); String getIp(); void setIp(String ip); int getPort(); void setPort(int port); int getWeight(); void setWeight(int weight); String getName(); void setName(String name); long getVersion(); void setVersion(long version); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }