@Test public void shouldHashCodesEqual() { 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"); int oneHashCode = endpointOne.hashCode(); int twoHashCode = endpointTwo.hashCode(); int threeHashCode = endpointThree.hashCode(); assertEquals(oneHashCode, twoHashCode); assertEquals(oneHashCode, threeHashCode); assertEquals(twoHashCode, threeHashCode); }
@Override public int hashCode() { int result = uri.hashCode(); result = 31 * result + httpMethod.hashCode(); return result; }
Endpoint { @Override public int hashCode() { int result = uri.hashCode(); result = 31 * result + httpMethod.hashCode(); return result; } }
Endpoint { @Override public int hashCode() { int result = uri.hashCode(); result = 31 * result + httpMethod.hashCode(); return result; } Endpoint(String uri, String httpMethod);  Endpoint(String uri, String httpMethod, String queryParam, String... queryParamValues); }
Endpoint { @Override public int hashCode() { int result = uri.hashCode(); result = 31 * result + httpMethod.hashCode(); return result; } 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 int hashCode() { int result = uri.hashCode(); result = 31 * result + httpMethod.hashCode(); return result; } 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();  }