@Test
public void testLoginOk() throws Exception {

    // Set up the login request
    LoginCredentials credentials = new LoginCredentials("jad", "1ad");
    HttpServletRequest request = buildLoginRequest(credentials);
    HttpServletResponse response = mock(HttpServletResponse.class);
    // Create mock OSGi services to inject
    MockLogService logservice = new MockLogService();
    // Create the resource and do the login
    Login resource = new Login();
    resource.logservice = logservice;
    createSubjectAndBindItToThread(request, response);
    LoginResult result = resource.doLogin(credentials);
    // Check the response
    assertThat(result.getRoles()).isNotEmpty();
    assertEquals("", result.getErrorMessage());
}