@Test
public void shouldSetSessionParameters() throws IOException {

    when(requestMock.getMethod()).thenReturn("POST");
    when(requestMock.getPathInfo()).thenReturn("/setLoggedInUser");
    HttpSession mockSession = Mockito.mock(HttpSession.class);
    when(requestMock.getSession(Mockito.anyBoolean())).thenReturn(mockSession);
    servlet.service(requestMock, responseMock);
    verify(mockSession).setAttribute("username", "Alice Bobson");
}