### Question:
GraphqlDataServiceImpl implements GraphqlDataService { @Override public ProductInterface getProductBySku(String sku, String storeView) { if (sku == null) { return null; } try { ArrayKey key = toProductCacheKey(sku, storeView); return productCache.get(key, () -> getProductBySkuImpl(sku, storeView)).orElse(null); } catch (ExecutionException e) { throw new RuntimeException(e); } }  @Activate void activate(GraphqlDataServiceConfiguration conf); @Override ProductInterface getProductBySku(String sku, String storeView); @Override CategoryTree getCategoryById(Integer id, String storeView); @Override CategoryTree getCategoryByPath(String urlPath, String storeView); @Override List<ProductInterface> searchProducts(String text, Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override List<CategoryTree> searchCategories(String text, Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override String getIdentifier();  }### Answer:
@Test public void testGetProductBySku() throws Exception { String query = getResource("graphql-queries/product-by-sku.txt"); Utils.setupHttpResponse("magento-graphql-product.json", httpClient, HttpStatus.SC_OK, query); ProductInterface product = dataService.getProductBySku(SKU, null); assertEquals(SKU, product.getSku()); assertEquals(NAME, product.getName()); assertTrue(product instanceof ConfigurableProduct); ConfigurableProduct configurableProduct = (ConfigurableProduct) product; assertEquals(15, configurableProduct.getVariants().size()); assertNull(dataService.getProductBySku(null, null)); }
@Test public void testNoProductBySku() throws Exception { Utils.setupHttpResponse("magento-graphql-no-product.json", httpClient, HttpStatus.SC_OK); assertNull(dataService.getProductBySku(SKU, null)); assertNull(dataService.getProductBySku(SKU, null)); }
@Test(expected = RuntimeException.class) public void testGetProductBySkuError() throws Exception { Utils.setupHttpResponse("magento-graphql-error.json", httpClient, HttpStatus.SC_OK); dataService.getProductBySku(SKU, null); }
@Test(expected = RuntimeException.class) public void testInvalidResponse() throws Exception { Utils.setupHttpResponse("sample-graphql-generic-response.json", httpClient, HttpStatus.SC_OK); dataService.getProductBySku(SKU, null); }