|
|
@ -73,4 +73,40 @@ class AccessControllerTest |
|
|
|
|
|
|
|
assertEquals(captor.getValue(), Integer.valueOf(400), "Should return Status code 400."); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void testLogout() |
|
|
|
{ |
|
|
|
when(request.headers(any())).thenReturn("testHeader"); |
|
|
|
when(service.logout(any())).thenReturn(true); |
|
|
|
|
|
|
|
final ArgumentCaptor<Integer> captor = ArgumentCaptor.forClass(Integer.class); |
|
|
|
|
|
|
|
new AccessController(service).logout(request, response); |
|
|
|
|
|
|
|
verify(response).status(captor.capture()); |
|
|
|
|
|
|
|
then(service).should().logout(any()); |
|
|
|
then(service).shouldHaveNoMoreInteractions(); |
|
|
|
|
|
|
|
assertEquals(captor.getValue(), Integer.valueOf(200), "Should return Status code 200."); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void failedLogoutTest() |
|
|
|
{ |
|
|
|
when(request.headers(any())).thenReturn("testHeader"); |
|
|
|
when(service.logout(any())).thenReturn(false); |
|
|
|
|
|
|
|
final ArgumentCaptor<Integer> captor = ArgumentCaptor.forClass(Integer.class); |
|
|
|
|
|
|
|
new AccessController(service).logout(request, response); |
|
|
|
|
|
|
|
verify(response).status(captor.capture()); |
|
|
|
|
|
|
|
then(service).should().logout(any()); |
|
|
|
then(service).shouldHaveNoMoreInteractions(); |
|
|
|
|
|
|
|
assertEquals(captor.getValue(), Integer.valueOf(400), "Should return Status code 400."); |
|
|
|
} |
|
|
|
} |