@Test public void setsAllNewCookieWithValidCookie() throws Exception {

  User user = User.named("username");
  when(request.getCookies()).thenReturn(ImmutableMap.of(SESSION_COOKIE, cookie));
  when(authenticator.authenticate(cookie)).thenReturn(Optional.of(user));
  NewCookie newCookie1 = new NewCookie(SESSION_COOKIE, "new session");
  when(sessionLoginResource.cookiesForUser(user))
      .thenReturn(ImmutableList.of(newCookie1));
  filter.filter(request, response);
  assertThat(getCookieMap(response)).contains(
      entry(newCookie1.getName(), newCookie1.getValue()));
}