Endpoint { public URL generateGetCapabilitiesURL() throws MalformedURLException { StringBuilder buildstr = new StringBuilder(url.replaceAll("\\?[^?]*$", "")); buildstr.append("?request=GetCapabilities&service="); buildstr.append(type); if (type == EndpointType.SOS) { buildstr.append("&version=1.0.0"); } return new URL(buildstr.toString()); } 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 testGenerateGetCapabilitiesURL() throws Exception { String url = "http: Endpoint instance = new Endpoint(url); URL expResult = new URL("http: URL result = instance.generateGetCapabilitiesURL(); assertThat(expResult, is(equalTo(result))); }