@Override
  public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException {
    if (!supportsGroups) {
      throw new UserPrincipalNotFoundException(group); // required by spec
    }
    return createGroupPrincipal(group);
  }
@Test
  public void testServiceNotSupportingGroups() throws IOException {
    UserPrincipalLookupService service = new UserLookupService(false);

    try {
      service.lookupPrincipalByGroupName("group");
      fail();
    } catch (UserPrincipalNotFoundException expected) {
      assertThat(expected.getName()).isEqualTo("group");
    }
  }