ResponseHandler { void addResultsToNode( final RootNode rootNode, final List<BaseDimensionalItemObject> dimensionalItemsFound, final List<String> fields ) { final CollectionNode collectionNode = fieldFilterService.toCollectionNode( BaseDimensionalItemObject.class, new FieldFilterParams( dimensionalItemsFound, fields ) ); collectionNode.setName( "dataItems" ); rootNode.addChild( collectionNode ); } ResponseHandler( final QueryService queryService, final LinkService linkService,
        final FieldFilterService fieldFilterService, final Environment environment, final CacheProvider cacheProvider );   }
@Test public void testAddResultsToNodeWithSuccess() { final RootNode anyRootNode = new RootNode( "any" ); final List<BaseDimensionalItemObject> anyDimensionalItems = asList( new BaseDimensionalItemObject( "any" ) ); final List<String> anyFields = asList( "any" ); final CollectionNode anyCollectionNode = new CollectionNode( "any" ); when( fieldFilterService.toCollectionNode( any(), any() ) ).thenReturn( anyCollectionNode ); responseHandler.addResultsToNode( anyRootNode, anyDimensionalItems, anyFields ); assertThat( anyRootNode, is( notNullValue() ) ); assertThat( anyRootNode.getName(), is( equalTo( "any" ) ) ); assertThat( anyRootNode.getChildren(), hasSize( 1 ) ); assertThat( anyRootNode.getChildren().get( 0 ).isCollection(), is( true ) ); }