@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())); }
@Override public Cookie getCookieNamed(String name) { return getCookies().stream().filter(c -> c.getName().equals(name)).findFirst().orElse(null); }
CinnamonWebDriverOptions implements WebDriver.Options { @Override public Cookie getCookieNamed(String name) { return getCookies().stream().filter(c -> c.getName().equals(name)).findFirst().orElse(null); } }
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); }
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(); }
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();  }