RestProjection extends LinkedHashMap<String, Object> { public static <T> List<RestProjection> createProjectionCollection(Collection<T> collection, List<String> fields, List<String> blobFields) { List<RestProjection> projectionCollection = new ArrayList<>(collection.size()); for (T element : collection) { projectionCollection.add(createProjection(element, fields, blobFields)); } return projectionCollection; }  static List<RestProjection> createProjectionCollection(Collection<T> collection, List<String> fields, List<String> blobFields); static RestProjection createProjection(T element, List<String> fields, List<String> blobFields);  }
@Test public void shouldCreateProjectionCollection() throws Exception { List<RestProjection> expectedProjections = Arrays.asList(buildRestProjection(recordOne), buildRestProjection(recordTwo), buildRestProjection(recordThree)); List<RestProjection> actualProjections = RestProjection.createProjectionCollection(records, REST_FIELDS, REST_BLOB_FIELDS); assertProjectionListsEquals(expectedProjections, actualProjections); }