### Question:
HelgolandConfiguration { protected String checkForApi(String url) { return url.endsWith(UrlSettings.BASE) ? url : url.endsWith("/api") ? url.concat("/") : url.endsWith("/") ? url.substring(0, url.lastIndexOf("/")).concat(UrlSettings.BASE) : url.concat(UrlSettings.BASE); }  String getExternalUrl(); void setExternalUrl(String externalUrl); @Setting(EXTERNAL_URL_KEY) void setExternalHelgolandUri(URI externalHelgolandUri); String getRequestIntervalRestriction(); @Setting(REQUEST_INTERVAL_RESTRICTION_KEY) void setRequestIntervalRestriction(String requestIntervalRestriction); static final String DEFAULT_URL; static final String DEFAULT_REQUEST_INTERVAL_RESTRICTION; }### Answer:
@Test public void when_UrlEndsBase() { String url = "http: String validated = config.checkForApi(url); assertEquals(EXPECTED_URL, validated); }
@Test public void when_UrlEndsBaseMissingSlash() { String url = "http: String validated = config.checkForApi(url); assertEquals(EXPECTED_URL, validated); }
@Test public void when_UrlSlash() { String url = "http: String validated = config.checkForApi(url); assertEquals(EXPECTED_URL, validated); }
@Test public void when_UrlOnly() { String url = "http: String validated = config.checkForApi(url); assertEquals(EXPECTED_URL, validated); }