### Question:
AmbariSwaggerReader extends JaxrsReader { static String joinPaths(String firstPath, String... paths) { StringBuilder joined = new StringBuilder(firstPath); for(String path: paths) { if (path.isEmpty()) { } else if (joined.length() == 0) { joined.append(path); } else if (joined.charAt(joined.length() - 1) == '/') { if (path.startsWith("/")) { joined.append(path.substring(1, path.length())); } else { joined.append(path); } } else { if (path.startsWith("/")) { joined.append(path); } else { joined.append('/').append(path); } } } return joined.toString(); } AmbariSwaggerReader(Swagger swagger, Log LOG); @Override Swagger getSwagger(); @Override Swagger read(Set<Class<?>> classes);  }### Answer:
@Test public void testJoinPaths() { assertEquals("/toplevel/nested/{param}/list", AmbariSwaggerReader.joinPaths("", "/", "/", "", "toplevel", "/nested/", "/{param}", "list")); assertEquals("/toplevel/nested/{param}/list", AmbariSwaggerReader.joinPaths("/", "toplevel", "", "/nested/", "/", "/{param}", "list", "")); }