@Test
public void testIsOwnedByOneOfFollowingGroups() throws Exception {

    final Metadata metadata = newMetadata(_inc);
    metadata.getSourceInfo().setGroupOwner(1);
    Metadata md1 = _repository.save(metadata);
    final Metadata metadata2 = newMetadata(_inc);
    metadata2.getSourceInfo().setGroupOwner(2);
    _repository.save(metadata2);
    final Metadata metadata3 = newMetadata(_inc);
    metadata3.getSourceInfo().setGroupOwner(3);
    Metadata md3 = _repository.save(metadata3);
    List<Metadata> found = _repository.findAll((Specification<Metadata>)isOwnedByOneOfFollowingGroups(Arrays.asList(1)));
    assertEquals(1, found.size());
    assertEquals(md1.getId(), found.get(0).getId());
    found = _repository.findAll((Specification<Metadata>)isOwnedByOneOfFollowingGroups(Arrays.asList(1, 3)), SortUtils.createSort(Metadata_.id));
    assertEquals(2, found.size());
    assertEquals(md1.getId(), found.get(0).getId());
    assertEquals(md3.getId(), found.get(1).getId());
}