@Test public void testEquals() { MutatedContainer m1 = new MutatedContainer(); setParams(m1, "a", "b", null); MutatedContainer m2 = new MutatedContainer(); setParams(m2, "a", "b", null); Assert.assertTrue(m1.equals(m2)); setParams(m1, "a", "b", null); setParams(m2, "c", "b", null); Assert.assertFalse(m1.equals(m2)); setParams(m1, "a", "b", null); setParams(m2, "a", "c", null); Assert.assertFalse(m1.equals(m2)); setParams(m1, "a", "b", new HashMap<String, String>()); setParams(m2, "a", "b", new HashMap<String, String>()); Assert.assertTrue(m1.equals(m2)); setParams(m1, "a", "b", new HashMap<String, String>()); setParams(m2, "a", "b", null); Assert.assertFalse(m1.equals(m2)); HashMap<String, String> h1 = new HashMap<String, String>(); h1.put("1", "1"); HashMap<String, String> h2 = new HashMap<String, String>(); h2.put("1", "2"); setParams(m1, "a", "b", h1); setParams(m2, "a", "b", h2); Assert.assertFalse(m1.equals(m2)); h1 = new HashMap<String, String>(); h1.put("1", "1"); h2 = new HashMap<String, String>(); h2.put("1", "1"); setParams(m1, "a", "b", h1); setParams(m2, "a", "b", h2); Assert.assertTrue(m1.equals(m2)); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } MutatedContainer rhs = (MutatedContainer) obj; return new EqualsBuilder().append(path, rhs.path) .append(queryParameters, rhs.queryParameters) .append(headers, rhs.headers).isEquals(); }
MutatedContainer { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } MutatedContainer rhs = (MutatedContainer) obj; return new EqualsBuilder().append(path, rhs.path) .append(queryParameters, rhs.queryParameters) .append(headers, rhs.headers).isEquals(); } }
MutatedContainer { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } MutatedContainer rhs = (MutatedContainer) obj; return new EqualsBuilder().append(path, rhs.path) .append(queryParameters, rhs.queryParameters) .append(headers, rhs.headers).isEquals(); }  }
MutatedContainer { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } MutatedContainer rhs = (MutatedContainer) obj; return new EqualsBuilder().append(path, rhs.path) .append(queryParameters, rhs.queryParameters) .append(headers, rhs.headers).isEquals(); }  static MutatedContainer generate(String queryParameters,
			String pathFormat, String... pathArgs); String getPath(); void setPath(String path); String getQueryParameters(); void setQueryParameters(String queryParameters); Map<String, String> getHeaders(); void setHeaders(Map<String, String> headers); boolean isModified(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
MutatedContainer { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } MutatedContainer rhs = (MutatedContainer) obj; return new EqualsBuilder().append(path, rhs.path) .append(queryParameters, rhs.queryParameters) .append(headers, rhs.headers).isEquals(); }  static MutatedContainer generate(String queryParameters,
			String pathFormat, String... pathArgs); String getPath(); void setPath(String path); String getQueryParameters(); void setQueryParameters(String queryParameters); Map<String, String> getHeaders(); void setHeaders(Map<String, String> headers); boolean isModified(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }