@Test public void shouldEquals() { Endpoint endpointOne = new Endpoint("URI", "HTTP_METHOD"); Endpoint endpointTwo = new Endpoint("URI", "HTTP_METHOD", "QUERY_PARAM", "VALUE"); Endpoint endpointThree = new Endpoint("URI", "HTTP_METHOD", "QUERY_PARAM", "VALUE", "VALUE2"); boolean oneEqualsTwo = endpointOne.equals(endpointTwo); boolean oneEqualsThree = endpointOne.equals(endpointThree); boolean twoEqualsOne = endpointTwo.equals(endpointOne); boolean twoEqualsThree = endpointTwo.equals(endpointThree); boolean threeEqualsOne = endpointThree.equals(endpointOne); boolean threeEqualsTwo = endpointThree.equals(endpointTwo); assertTrue(oneEqualsTwo); assertTrue(oneEqualsThree); assertTrue(twoEqualsOne); assertTrue(twoEqualsThree); assertTrue(threeEqualsOne); assertTrue(threeEqualsTwo); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Endpoint that = (Endpoint) o; if (!httpMethod.equals(that.httpMethod)) return false; if (!uri.startsWith(that.uri)) return false; return true; }
Endpoint { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Endpoint that = (Endpoint) o; if (!httpMethod.equals(that.httpMethod)) return false; if (!uri.startsWith(that.uri)) return false; return true; } }
Endpoint { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Endpoint that = (Endpoint) o; if (!httpMethod.equals(that.httpMethod)) return false; if (!uri.startsWith(that.uri)) return false; return true; } Endpoint(String uri, String httpMethod);  Endpoint(String uri, String httpMethod, String queryParam, String... queryParamValues); }
Endpoint { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Endpoint that = (Endpoint) o; if (!httpMethod.equals(that.httpMethod)) return false; if (!uri.startsWith(that.uri)) return false; return true; } Endpoint(String uri, String httpMethod);  Endpoint(String uri, String httpMethod, String queryParam, String... queryParamValues); Set<QueryParameterMatcher> getQueryParamMatchers(); @Override boolean equals(Object o); @Override int hashCode(); }
Endpoint { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Endpoint that = (Endpoint) o; if (!httpMethod.equals(that.httpMethod)) return false; if (!uri.startsWith(that.uri)) return false; return true; } Endpoint(String uri, String httpMethod);  Endpoint(String uri, String httpMethod, String queryParam, String... queryParamValues); Set<QueryParameterMatcher> getQueryParamMatchers(); @Override boolean equals(Object o); @Override int hashCode();  }