@Test
public void shouldSendRedirect() throws IOException {

    when(requestMock.getScheme()).thenReturn("https");
    when(requestMock.getServerName()).thenReturn("messages.example.com");
    when(requestMock.getServerPort()).thenReturn(443);
    when(requestMock.getContextPath()).thenReturn("");
    when(requestMock.getServletPath()).thenReturn("");
    when(requestMock.getMethod()).thenReturn("GET");
    when(requestMock.getPathInfo()).thenReturn("/redirect");
    servlet.service(requestMock, responseMock);
    verify(responseMock).sendRedirect("/login");
}