### Question:
Resources extends LinkContainer<Resources<T>> implements ViewSupplier { public static <R> Resources<R> of(Stream<R> resources, URI href) { return of(resources.collect(Collectors.toList()), href); } protected  Resources(Collection<T> resources, URI self, Pagination pagination, Class<?> viewType); Resources<T> forView(Class<?> viewType); static Resources<R> of(Stream<R> resources, URI href); static Resources<R> of(Collection<R> resources, URI href); Resources<T> withPagination(Pagination pagination); Resources<V> transform(Function<T, V> fn);  }### Answer:
@Test public void to_json() throws JsonProcessingException { Resources<Dummy> collection = Resources.of( Arrays.asList( new Dummy("1"), new Dummy("2") ), URI.create("http: ); assertResourceJson( mapper, object() .with("_self", "http: .with("resources", array() .with(object() .with("version", "1") .end()) .with(object() .with("version", "2") .end()) .end()) .end(), ObjectMapperFactory.create().valueToTree(collection) ); }
@Test public void resource_collection_with_filtering() throws JsonProcessingException { Project project = Project.of(new NameDescription("PRJ", "Project")); List<Branch> branches = Arrays.asList( Branch.of(project, new NameDescription("B1", "Branch 1")).withSignature(SIGNATURE), Branch.of(project, new NameDescription("B2", "Branch 2")).withSignature(SIGNATURE) ); Resources<Branch> resourceCollection = Resources.of( branches, URI.create("urn:branch") ); assertResourceJson( mapper, object() .with("_self", "urn:branch") .with("resources", array() .with(object() .with("id", 0) .with("name", "B1") .with("description", "Branch 1") .with("disabled", false) .with("type", "CLASSIC") .with("signature", SIGNATURE_OBJECT) .end()) .with(object() .with("id", 0) .with("name", "B2") .with("description", "Branch 2") .with("disabled", false) .with("type", "CLASSIC") .with("signature", SIGNATURE_OBJECT) .end()) .end()) .end(), resourceCollection, Resources.class ); }