### Question:
ProductService { public List<Product> getProducts() { Map<String, ProductDTO> productDTOs = productRepo.getProductDTOs(); Map<String, StockDTO> stockDTOMap = stockRepo.getStockDTOs(); return productDTOs.values().stream() .map(productDTO -> { StockDTO stockDTO = stockDTOMap.getOrDefault(productDTO.getId(), DEFAULT_STOCK_DTO); return new Product(productDTO.getId(), stockDTO.getSku(), productDTO.getName(), productDTO.getDescription(), getPrice(productDTO), stockDTO.getAmountAvailable()); }) .collect(toList()); } ProductService(StockRepo stockRepo, ProductRepo productRepo, FeatureFlagsService featureFlagsService, AdaptivePricingRepo adaptivePricingRepo); List<Product> getProducts(); List<Product> productsNotFound();  }### Answer:
@Test public void originalPricesAreKeptWhenFlagIsOff() { when(featureFlagsService.shouldApplyFeatureWithFlag(anyLong())).thenReturn(false); final List<Product> actualProducts = productService.getProducts(); assertThat(actualProducts, containsInAnyOrder(expectedProducts.toArray(new Product[0]))); }
@Test public void originalPriceIsUsedWhenAdaptivePricingFailsEvenIfFlagIsOn() { when(featureFlagsService.shouldApplyFeatureWithFlag(anyLong())).thenReturn(true); when(adaptivePricingRepo.getPriceFor(anyString())).thenReturn(Optional.empty()); final List<Product> actualProducts = productService.getProducts(); assertThat(actualProducts, containsInAnyOrder(expectedProducts.toArray(new Product[0]))); }