@Test public void shouldFindExistingCookie() { WebDriver driver = mock(WebDriver.class); Options options = mock(Options.class); Cookie cookie = new Cookie(cookieName, "oki-doki"); when(driver.manage()).thenReturn(options); when(options.getCookieNamed(eq(cookieName))).thenReturn(cookie); assertThat("Cookie not found!", driver, hasCookie(cookieName)); }
@Factory public static Matcher<WebDriver> hasCookie(String name) { return new HasCookieMatcher(name); }
HasCookieMatcher extends TypeSafeMatcher<WebDriver> { @Factory public static Matcher<WebDriver> hasCookie(String name) { return new HasCookieMatcher(name); } }
HasCookieMatcher extends TypeSafeMatcher<WebDriver> { @Factory public static Matcher<WebDriver> hasCookie(String name) { return new HasCookieMatcher(name); } protected  HasCookieMatcher(String name); }
HasCookieMatcher extends TypeSafeMatcher<WebDriver> { @Factory public static Matcher<WebDriver> hasCookie(String name) { return new HasCookieMatcher(name); } protected  HasCookieMatcher(String name); @Override void describeTo(Description description); @Factory static Matcher<WebDriver> hasCookie(String name); }
HasCookieMatcher extends TypeSafeMatcher<WebDriver> { @Factory public static Matcher<WebDriver> hasCookie(String name) { return new HasCookieMatcher(name); } protected  HasCookieMatcher(String name); @Override void describeTo(Description description); @Factory static Matcher<WebDriver> hasCookie(String name);  }