JobListServiceURLBuilderImpl implements ServiceURLBuilder { public String build(String url, String... parameters) { String rmUrl = URLUtil.removeTrailingSlash(url); String restApi = Constants.V2_APPS_URL; if (parameters != null && parameters.length > 0) { String jobState = parameters[0]; if (jobState.equalsIgnoreCase(Constants.JobState.RUNNING.toString())) { restApi = Constants.V2_APPS_RUNNING_URL; } else if (jobState.equalsIgnoreCase(Constants.JobState.FINISHED.toString())) { restApi = Constants.V2_APPS_COMPLETED_URL; } } StringBuilder sb = new StringBuilder(); sb.append(rmUrl).append("/").append(restApi); sb.append("&").append(Constants.ANONYMOUS_PARAMETER); return sb.toString(); }  String build(String url, String... parameters);  }
@Test public void testBuild() { JobListServiceURLBuilderImpl jobListServiceURLBuilderImpl = new JobListServiceURLBuilderImpl(); String finalUrl = jobListServiceURLBuilderImpl.build("http: Assert.assertEquals("http: finalUrl = jobListServiceURLBuilderImpl.build("http: Assert.assertEquals("http: finalUrl = jobListServiceURLBuilderImpl.build("http: Assert.assertEquals("http: finalUrl = jobListServiceURLBuilderImpl.build("http: Assert.assertEquals("http: }