UsernamePasswordCredentialToPrincipalResolver implements CredentialToPrincipalResolver { @Override public boolean supports(KnightCredential credential) { return credential != null && (this.classToSupport.equals(credential.getClass()) || (this.classToSupport .isAssignableFrom(credential.getClass())) && this.supportSubClasses); }  void setSupportSubClasses(boolean supportSubClasses); @Override KnightUser resolvePrincipal(KnightCredential credential); @Override boolean supports(KnightCredential credential);  }
@Test public void testSupports(){ Assert.assertFalse(resolver.supports(null)); Credential credential = Mockito.mock(Credential.class); Assert.assertFalse(resolver.supports(credential)); credential = new UsernamePasswordCredential(); Assert.assertTrue(resolver.supports(credential)); credential = new SubUsernamePasswordCredential(); Assert.assertTrue(resolver.supports(credential)); }