### Question:
CinnamonWebDriverOptions implements WebDriver.Options { @Override public Cookie getCookieNamed(String name) { return getCookies().stream().filter(c -> c.getName().equals(name)).findFirst().orElse(null); } CinnamonWebDriverOptions(final WebDriver webDriver); @Override void addCookie(Cookie cookie); @Override void deleteCookieNamed(String name); @Override void deleteCookie(Cookie cookie); @Override void deleteAllCookies(); @Override Set<Cookie> getCookies(); @Override Cookie getCookieNamed(String name); @Override WebDriver.Timeouts timeouts(); @Override WebDriver.ImeHandler ime(); @Override WebDriver.Window window(); @Override Logs logs();  }### Answer:
@Test public void shouldHandleCookieWithEmptyValueForBrowsersThatRequireJavaScript() { when(((HasCapabilities) mockDriver).getCapabilities()).thenReturn(DesiredCapabilities.safari()); doReturn("cookiea=;cookieb=123;cookiec=").when((JavascriptExecutor) mockDriver).executeScript("return (document.cookie);"); CinnamonWebDriverOptions options = new CinnamonWebDriverOptions(mockDriver); assertThat(options.getCookieNamed("cookiea").getValue(), is("")); assertThat(options.getCookieNamed("cookieb").getValue(), is("123")); }
@Test public void shouldReturnNullForNonExistentCookie() { when(((HasCapabilities) mockDriver).getCapabilities()).thenReturn(DesiredCapabilities.safari()); doReturn("cookiea=123").when((JavascriptExecutor) mockDriver).executeScript("return (document.cookie);"); CinnamonWebDriverOptions options = new CinnamonWebDriverOptions(mockDriver); assertThat(options.getCookieNamed("nonExistentCookie"), is(nullValue())); }