@SuppressWarnings("unchecked") @Test void testDeleteUnknownGroup() { String groupName = "group"; Package pack = mock(Package.class); when(pack.getId()).thenReturn(groupName); Query<Group> groupQuery = mock(Query.class, RETURNS_SELF); when(dataService.query(GROUP, Group.class)).thenReturn(groupQuery); when(groupQuery.eq(GroupMetadata.ROOT_PACKAGE, groupName).findOne()).thenReturn(null); groupPackageService.deleteGroup(pack); assertAll( () -> verifyNoMoreInteractions(dataService), () -> verifyNoInteractions(mutableAclService)); }
@Override public void deleteGroup(Package rootPackage) { Group group = getGroup(rootPackage); if (group != null) { deleteRoles(group); dataService.delete(GROUP, group); mutableAclService.deleteAcl(new GroupIdentity(group.getName()), true); } }
GroupPackageServiceImpl implements GroupPackageService { @Override public void deleteGroup(Package rootPackage) { Group group = getGroup(rootPackage); if (group != null) { deleteRoles(group); dataService.delete(GROUP, group); mutableAclService.deleteAcl(new GroupIdentity(group.getName()), true); } } }
GroupPackageServiceImpl implements GroupPackageService { @Override public void deleteGroup(Package rootPackage) { Group group = getGroup(rootPackage); if (group != null) { deleteRoles(group); dataService.delete(GROUP, group); mutableAclService.deleteAcl(new GroupIdentity(group.getName()), true); } } GroupPackageServiceImpl(
      GroupValueFactory groupValueFactory,
      RoleMembershipService roleMembershipService,
      RoleFactory roleFactory,
      DataService dataService,
      GroupFactory groupFactory,
      MutableAclService mutableAclService,
      GroupService groupService); }
GroupPackageServiceImpl implements GroupPackageService { @Override public void deleteGroup(Package rootPackage) { Group group = getGroup(rootPackage); if (group != null) { deleteRoles(group); dataService.delete(GROUP, group); mutableAclService.deleteAcl(new GroupIdentity(group.getName()), true); } } GroupPackageServiceImpl(
      GroupValueFactory groupValueFactory,
      RoleMembershipService roleMembershipService,
      RoleFactory roleFactory,
      DataService dataService,
      GroupFactory groupFactory,
      MutableAclService mutableAclService,
      GroupService groupService); @Override void createGroup(Package rootPackage); @Override void createGroups(List<Package> packages); @Override void deleteGroup(Package rootPackage); }
GroupPackageServiceImpl implements GroupPackageService { @Override public void deleteGroup(Package rootPackage) { Group group = getGroup(rootPackage); if (group != null) { deleteRoles(group); dataService.delete(GROUP, group); mutableAclService.deleteAcl(new GroupIdentity(group.getName()), true); } } GroupPackageServiceImpl(
      GroupValueFactory groupValueFactory,
      RoleMembershipService roleMembershipService,
      RoleFactory roleFactory,
      DataService dataService,
      GroupFactory groupFactory,
      MutableAclService mutableAclService,
      GroupService groupService); @Override void createGroup(Package rootPackage); @Override void createGroups(List<Package> packages); @Override void deleteGroup(Package rootPackage);  }