"[INFO] - Cookie: [del] key2 (domain=localhost, path=/)"))));
}
@Test
public void cookieFilter() {
runner.setCookieFilter(new CookieFilter(FilterType.SKIP, "key2"));
execute("cookie");
assertThat(result, is(instanceOf(Warning.class)));
List<String> actual = getSystemOut(new Filter() {
private boolean fetch = false;
@Override
public String filter(String line) {
if (!fetch && line.contains("deleteAllVisibleCookies")) {
fetch = true;
} else if (fetch && line.contains("- Cookie:")) {
return line
.replaceFirst("^\\[[^\\]]+\\]\\s+", "") // suppress timestamp.
.replaceFirst("domain=\\*", "domain=localhost"); // fixup safari driver's bug.
}
return null;
}
});
assertThat(actual, is(equalTo(Arrays.asList(
"[INFO] - Cookie: [add] key1=[value1] (domain=localhost, path=/, expire=*)",
"[INFO] - Cookie: [add] key3=[value3] (domain=localhost, path=/, expire=*)",
"[ERROR] - Cookie: key1=[value1] (domain=localhost, path=/, expire=*)",
"[ERROR] - Cookie: key3=[value3] (domain=localhost, path=/, expire=*)",
"[INFO] - Cookie: [del] key3 (domain=localhost, path=/)"))));
testSuites.clear();
runner.setCookieFilter(new CookieFilter(FilterType.PASS, "key1"));
execute("cookie2");
assertThat(result, is(instanceOf(Success.class)));
List<String> actual2 = getSystemOut(new Filter() {
@Override