@Test public void addPrincipalsDoesNothing() { Set<?> set = Mockito.mock(Set.class); loginPlugin.addPrincipals(set); verifyZeroInteractions(set); }
@Test public void initDoesNothing() throws Exception { // when loginPlugin.doInit(callbackHandler, jcrSession, options); // then verifyZeroInteractions(callbackHandler, jcrSession, options); }
@Test public void returnsPrincipalWithSameNameAsCredentials() throws Exception { // given String name = "joe"; char[] password = {'f', 'o', 'o'}; Credentials credentials = new SimpleCredentials(name, password); // when Principal principal = loginPlugin.getPrincipal(credentials); // then assertEquals(principal.getName(), name); }
@Test public void impersonateAsDefault() throws Exception { assertEquals(LoginModulePlugin.IMPERSONATION_DEFAULT, loginPlugin.impersonate(null, null)); }
@Test public void canNotHandleOtherThanSimpleCredentials() { Credentials credentials = mock(Credentials.class); assertFalse(loginPlugin.canHandle(credentials)); }
@Test public void canHandleSimpleCredentials() { assertTrue(loginPlugin.canHandle(simpleCredentials())); }
@Test public void getAuthPluginAsProvided() throws Exception { assertEquals(authPlugin, loginPlugin.getAuthentication(null, null)); verifyZeroInteractions(authPlugin); }