Endpoint { private void createComparisonString() { Pattern urlPattern = Pattern.compile("([^\\?]*/)(?:[^/\\?]*(?:\\?.*)?){1}"); Matcher matcher = urlPattern.matcher(url); if (matcher.matches()) { comparisonString = matcher.group(1); } else { throw new UnsupportedOperationException("Cannot create endpoint with invalid URL"); } } Endpoint(String url); String getURL(); EndpointType getType(); String getComparisonString(); URL generateGetCapabilitiesURL(); boolean equals(Endpoint other); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testCreateComparisonString() { System.out.println("createComparisonString"); String expResult = "https: String result = testpoint.getComparisonString(); assertThat(expResult, is(equalTo(result))); testpoint = new Endpoint("https: result = testpoint.getComparisonString(); assertThat(expResult, is(equalTo(result))); testpoint = new Endpoint("https: result = testpoint.getComparisonString(); assertThat(expResult, is(equalTo(result))); }