VoBrandServiceImpl implements VoBrandService { @Override public VoSearchResult<VoBrand> getFilteredBrands(final VoSearchContext filter) throws Exception { final VoSearchResult<VoBrand> result = new VoSearchResult<>(); final List<VoBrand> results = new ArrayList<>(); result.setSearchContext(filter); result.setItems(results); final SearchContext searchContext = new SearchContext( filter.getParameters(), filter.getStart(), filter.getSize(), filter.getSortBy(), filter.isSortDesc(), "filter" ); final SearchResult<BrandDTO> batch = dtoBrandService.findBrands(searchContext); if (!batch.getItems().isEmpty()) { results.addAll(voAssemblySupport.assembleVos(VoBrand.class, BrandDTO.class, batch.getItems())); } result.setTotal(batch.getTotal()); return result; } VoBrandServiceImpl(final DtoBrandService dtoBrandService,
                              final DtoAttributeService dtoAttributeService,
                              final FederationFacade federationFacade,
                              final VoAssemblySupport voAssemblySupport,
                              final VoIOSupport voIOSupport); @Override VoSearchResult<VoBrand> getFilteredBrands(final VoSearchContext filter); @Override VoBrand getBrandById(final long id); @Override VoBrand updateBrand(final VoBrand vo); @Override VoBrand createBrand(final VoBrand vo); @Override void removeBrand(final long id); @Override List<VoAttrValueBrand> getBrandAttributes(final long brandId); @Override List<VoAttrValueBrand> updateBrandAttributes(final List<MutablePair<VoAttrValueBrand, Boolean>> vo); void setSkipAttributesInView(List<String> attributes);  }
@Test public void testGetBrands() throws Exception { VoSearchContext ctxNoFilter = new VoSearchContext(); ctxNoFilter.setSize(10); VoSearchResult<VoBrand> brandNoFilter = voBrandService.getFilteredBrands(ctxNoFilter); assertNotNull(brandNoFilter); assertFalse(brandNoFilter.getItems().isEmpty()); VoSearchContext ctxFind = new VoSearchContext(); ctxFind.setParameters(createSearchContextParams("filter", "FutureRobots")); ctxFind.setSize(10); VoSearchResult<VoBrand> brandFind = voBrandService.getFilteredBrands(ctxFind); assertNotNull(brandFind); assertFalse(brandFind.getItems().isEmpty()); final VoBrand c101 = brandFind.getItems().get(0); assertEquals(101L, c101.getBrandId()); assertEquals("FutureRobots", c101.getName()); }