/** * Prepare for tests. * * @throws Exception in case of error happens */ @SuppressWarnings("unchecked") @Before public void setUp() throws Exception { mockElasticPath = context.mock(ElasticPath.class); mockProductService = context.mock(ProductService.class); mockImportExportSearcher = context.mock(ImportExportSearcher.class); mockProductAdapter = context.mock(DomainAdapter.class); context.checking( new Expectations() { { allowing(mockProductService) .findByUids(with(any(Collection.class)), with(aNull(ProductLoadTuner.class))); will(returnValue(getFoundedProductsList())); allowing(mockProductAdapter) .populateDTO(with(any(Product.class)), with(any(ProductDTO.class))); allowing(mockProductAdapter).createDtoObject(); will(returnValue(new ProductDTO())); } }); productExporter = new ProductExporterImpl(); productExporter.setElasticPath(mockElasticPath); productExporter.setImportExportSearcher(mockImportExportSearcher); productExporter.setProductService(mockProductService); productExporter.setProductAdapter(mockProductAdapter); }