@Test
public void testLogoutNotLoggedIn() throws Exception {

    // Set up the request and response used to do the login
    HttpServletRequest request = mock(HttpServletRequest.class);
    HttpServletResponse response = mock(HttpServletResponse.class);
    // Create mock OSGi services to inject
    MockLogService logservice = new MockLogService();
    // Set up shiro
    createSubjectAndBindItToThread(request, response);
    // Create the resource and do the logout
    Logout resource = new Logout();
    resource.logservice = logservice;
    LoginResult result = resource.doLogout();
    // Check the response
    assertEquals(0, result.getRoles().length);
    assertEquals("", result.getErrorMessage());
}