EndpointGroupUtil { static String replaceEndpointGroup(String uri, String endpointUri) { final Matcher matcher = ENDPOINT_GROUP_PATTERN.matcher(uri); if (matcher.find()) { return new StringBuilder(uri).replace(matcher.start(1), matcher.end(1), endpointUri).toString(); } return uri; } private  EndpointGroupUtil();   }
@Test public void testReplace() throws Exception { final String replacement = "127.0.0.1:1234"; assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: assertEquals("http: replaceEndpointGroup("http: "myGroupName:8080/xxx", replacement)); }