### Question:
FluentDriver extends AbstractFluentDriverSearchControl { @Override public String url() { String baseUrl = buildUrl(null); String currentUrl = getDriver().getCurrentUrl(); if (currentUrl != null && baseUrl != null && currentUrl.startsWith(baseUrl)) { currentUrl = currentUrl.substring(baseUrl.length()); } return currentUrl; } FluentDriver(WebDriver driver, Configuration configuration, FluentControl adapter); Configuration getConfiguration(); @Override void takeHtmlDump(); @Override void takeHtmlDump(String fileName); @Override boolean canTakeScreenShot(); @Override void takeScreenshot(); @Override void takeScreenshot(String fileName); @Override WebDriver getDriver(); @Override AppiumDriver<?> getAppiumDriver(); @Override EventsRegistry events(); @Override MouseActions mouse(); @Override KeyboardActions keyboard(); @Override WindowAction window(); @Override FluentWait await(); @Override Set<Cookie> getCookies(); @Override Cookie getCookie(String name); @Override String url(); @Override String pageSource(); @Override P goTo(P page); @Override void goTo(String url); @Override void goToInNewTab(String url); @Override Capabilities capabilities(); @Override FluentJavascript executeScript(String script, Object... args); @Override FluentJavascript executeAsyncScript(String script, Object... args); @Override void switchTo(FluentList<? extends FluentWebElement> elements); @Override void switchTo(FluentWebElement element); @Override void switchTo(); @Override void switchToDefault(); @Override Alert alert(); void quit(); void releaseFluent(); @Override ContainerContext inject(Object container); @Override T newInstance(Class<T> cls); @Override ContainerContext injectComponent(Object componentContainer, Object parentContainer, SearchContext searchContext); @Override CssSupport css(); @Override PerformanceTiming performanceTiming(); @Override ChromiumApi getChromiumApi();  }### Answer:
@Test public void shouldReturnNullUrlIfNoCurrentUrlFromDriverIsPresent() { fluentDriver = spy(new FluentDriver(webDriver, configuration, adapter)); when(webDriver.getCurrentUrl()).thenReturn(null); assertThat(fluentDriver.url()).isNull(); }
@Test public void shouldReturnCurrentUrlFromDriverUrlIfNoBaseUrlIsPresent() { fluentDriver = spy(new FluentDriver(webDriver, configuration, adapter)); when(webDriver.getCurrentUrl()).thenReturn("https: when(configuration.getBaseUrl()).thenReturn(null); assertThat(fluentDriver.url()).isEqualTo("https: }
@Test public void shouldReturnCurrentUrlFromDriverIfCurrentUrlDoesntStartWithBaseUrl() { fluentDriver = spy(new FluentDriver(webDriver, configuration, adapter)); when(webDriver.getCurrentUrl()).thenReturn("https: when(configuration.getBaseUrl()).thenReturn("https: assertThat(fluentDriver.url()).isEqualTo("https: }
@Test public void shouldReturnUrl() { fluentDriver = spy(new FluentDriver(webDriver, configuration, adapter)); when(webDriver.getCurrentUrl()).thenReturn("https: when(configuration.getBaseUrl()).thenReturn("https: assertThat(fluentDriver.url()).isEqualTo("?q=fluentlenium&ia=web"); }