### Question:
YarnEndpoint { @VisibleForTesting public String removeLeadingAndTrailingSlash(String s) { return s.replaceAll("^/+", "").replaceAll("/+$", ""); } YarnEndpoint(String apiEndpoint, String path); String getApiEndpoint(); void setApiEndpoint(String apiEndpoint); String getContextRoot(); String getVersion(); String getPath(); void setPath(String path); URL getFullEndpointUrl(); @VisibleForTesting String removeLeadingAndTrailingSlash(String s);  }### Answer:
@Test public void testRemoveLeadingAndTrailingSlash() { String testString = " String expectedString = "test"; YarnEndpoint yarnEndpoint = new YarnEndpoint("", ""); assertEquals(expectedString, yarnEndpoint.removeLeadingAndTrailingSlash(testString)); }