DataSetLoaderImpl implements DataSetLoader { @Override public List<HasId> loadObjectsByIds(Set<Object> ids, String entityTypeName) throws EntityNotFoundException, NotAuthorizedException { Preconditions.checkArgument(!CollectionUtils.isEmpty(ids)); EasyCrudService service = easyCrudServiceResolver.resolveByEntityType(entityTypeName); Object firstId = ids.iterator().next(); List<HasId> ret = new ArrayList<>(ids.size()); if (ids.size() == 1) { HasId loaded = loadOne(firstId, service); ret.add(loaded); } else if (firstId instanceof Long || firstId instanceof String) { Query query; if (firstId instanceof String) { query = Query.n().in(HasId.FN_ID, ids.toArray(new String[0])); } else { query = Query.n().in(HasId.FN_ID, ids.toArray(new Long[0])); } List loaded = loadMultipleByQuery(query, service); assertFound(loaded.size() == ids.size(), entityTypeName, "One of: " + Arrays.toString(ids.toArray())); ret.addAll(loaded); } else { List<HasId> loaded = loadOneByOne(ids, service); ret.addAll(loaded); } return ret; }  @Override List<HasId> loadObjectsByIds(Set<Object> ids, String entityTypeName); @Override void loadObjectsByIds(Set<Object> ids, String entityTypeName, DataSet dataSet); @Override void loadObjectsByIds(Map<String, Set<Object>> ids, DataSet dataSet); @Override void loadObjectAndItsRefs(Object id, String entityTypeName, DataSet dataSet, Ref... references); @Override void resolveReferencedObjects(DataSet dataSet, Ref... references); ReferencesRegistry getReferencesRegistry(); @Autowired void setReferencesRegistry(ReferencesRegistry referencesRegistry); EasyCrudServiceResolver getEasyCrudServiceResolver(); @Autowired void setEasyCrudServiceResolver(EasyCrudServiceResolver easyCrudServiceResolver);  }
@Test(expected = IllegalArgumentException.class) public void testLoadObjectsByIds_ExpectIaeForEmptyIds() throws Exception { DataSetLoaderImpl fixture = buildMockedInstance(); fixture.loadObjectsByIds(null, "asdasd"); }
@Test(expected = IllegalArgumentException.class) public void testLoadObjectsByIds_ExpectIaeForEmptyIds2() throws Exception { DataSetLoaderImpl fixture = buildMockedInstance(); fixture.loadObjectsByIds(new HashSet<>(), "asdasd"); }