@Test
public void testGetJWTFromCookie() throws Exception {

  HttpServletRequest request = createNiceMock(HttpServletRequest.class);
  Cookie cookie = createNiceMock(Cookie.class);
  expect(cookie.getName()).andReturn("non-default");
  expect(cookie.getValue()).andReturn("stubtokenstring");
  expect(request.getCookies()).andReturn(new Cookie[]{cookie});
  JwtAuthenticationProperties properties = createTestProperties();
  JwtAuthenticationFilter filter = new JwtAuthenticationFilter(properties, null, null);
  replay(request, cookie);
  String jwtFromCookie = filter.getJWTFromCookie(request);
  verify(request, cookie);
  assertEquals("stubtokenstring", jwtFromCookie);
}