@Test(expected = InsufficientAuthenticationException.class) public void shouldFailToProvideUserId() { // Given: final SecurityControllerMixin securityController = new NullAuthenticationSecurityController(); // When: securityController.getUserId(); // Then: (exception) }
@Test public void shouldFailToProvideUserAccountMap() { // Given: final SecurityControllerMixin securityController = new NullAuthenticationSecurityController(); // When: final Map<String, ?> map = securityController.newMapWithAccount(); // Then: assertEquals(1, map.size()); assertNull(map.get(SecurityControllerMixin.USER_ACCOUNT_KEY)); }
@Test public void shouldNotHaveUserAccount() { // Given: final SecurityControllerMixin securityController = new NullAuthenticationSecurityController(); // When: final UserDetails userDetails = securityController.getUserAccount(); final boolean hasAccount = securityController.hasUserAccount(); // Then: assertNull(userDetails); assertFalse(hasAccount); }