Skip to content

Instantly share code, notes, and snippets.

@ian-ellis
Created January 16, 2017 22:45
Show Gist options
  • Save ian-ellis/1d45b1a31aafefdb531ff19784ed8c47 to your computer and use it in GitHub Desktop.
Save ian-ellis/1d45b1a31aafefdb531ff19784ed8c47 to your computer and use it in GitHub Desktop.
CatalogProductEntity mockProduct(String sku, String name, String brand, Double price, Double specialPrice, List<String> imageUrls){
return Mock(CatalogProductEntity) {
it.getSku() >> sku
it.getName() >> name
it.getBrand() >> Mock(BrandEntity){
it.getName() >> brand
}
it.getPrice() >> price
it.getSpecialPrice() >> specialPrice
it.getImages() >> imageUrls.collect{ url->
return Mock(ImageEntity){
it.getUrl() >> url
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment