TwitterApi { public Uri.Builder buildUponBaseHostUrl(String... paths) { final Uri.Builder builder = Uri.parse(getBaseHostUrl()).buildUpon(); if (paths != null) { for (String p : paths) { builder.appendPath(p); } } return builder; } TwitterApi();  TwitterApi(String baseHostUrl); String getBaseHostUrl(); Uri.Builder buildUponBaseHostUrl(String... paths); static String buildUserAgent(String clientName, String version); static final String BASE_HOST; static final String BASE_HOST_URL; }
@Test public void testBuildUponBaseHost_singlePath() { final String baseHost = "testbasehost"; final TwitterApi api = new TwitterApi(baseHost); final Uri.Builder builder = api.buildUponBaseHostUrl("path1"); assertEquals(baseHost + "/path1", builder.build().toString()); }
@Test public void testBuildUponBaseHost_multiplePaths() { final String baseHost = "testbasehost"; final TwitterApi api = new TwitterApi(baseHost); final Uri.Builder builder = api.buildUponBaseHostUrl("path1", "path2"); assertEquals(baseHost + "/path1/path2", builder.build().toString()); }