@Test public void testServiceNotSupportingGroups() throws IOException { UserPrincipalLookupService service = new UserLookupService(false); try { service.lookupPrincipalByGroupName("group"); fail(); } catch (UserPrincipalNotFoundException expected) { assertThat(expected.getName()).isEqualTo("group"); } }
@Override public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException { if (!supportsGroups) { throw new UserPrincipalNotFoundException(group); } return createGroupPrincipal(group); }
UserLookupService extends UserPrincipalLookupService { @Override public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException { if (!supportsGroups) { throw new UserPrincipalNotFoundException(group); } return createGroupPrincipal(group); } }
UserLookupService extends UserPrincipalLookupService { @Override public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException { if (!supportsGroups) { throw new UserPrincipalNotFoundException(group); } return createGroupPrincipal(group); } UserLookupService(boolean supportsGroups); }
UserLookupService extends UserPrincipalLookupService { @Override public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException { if (!supportsGroups) { throw new UserPrincipalNotFoundException(group); } return createGroupPrincipal(group); } UserLookupService(boolean supportsGroups); @Override UserPrincipal lookupPrincipalByName(String name); @Override GroupPrincipal lookupPrincipalByGroupName(String group); }
UserLookupService extends UserPrincipalLookupService { @Override public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException { if (!supportsGroups) { throw new UserPrincipalNotFoundException(group); } return createGroupPrincipal(group); } UserLookupService(boolean supportsGroups); @Override UserPrincipal lookupPrincipalByName(String name); @Override GroupPrincipal lookupPrincipalByGroupName(String group);  }