Created
January 16, 2017 22:44
-
-
Save ian-ellis/72225082c03f5e42adb2a50a51e2a18e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private CatalogProductEntity mockProduct(String sku, String name, String brandName, Double price, Double specialPrice, List<String> imageUrls){ | |
BrandEntity brand = mock(BrandEntity.class); | |
when(brand.getName()).thenReturn(brandName); | |
ArrayList<ImageEntity> images = new ArrayList<>(); | |
for(String imageUrl : imageUrls){ | |
ImageEntity imageEntity = mock(ImageEntity.class); | |
when(imageEntity.getUrl()).thenReturn(imageUrl); | |
images.add(imageEntity); | |
} | |
CatalogProductEntity product = mock(CatalogProductEntity.class); | |
when(product.getImages()).thenReturn(images); | |
when(product.getBrand()).thenReturn(brand); | |
when(product.getSku()).thenReturn(sku); | |
when(product.getName()).thenReturn(name); | |
when(product.getPrice()).thenReturn(price); | |
when(product.getSpecialPrice()).thenReturn(specialPrice); | |
return product; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment