Search in sources :

Example 1 with ImageResource

use of com.day.cq.commons.ImageResource in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class MockCommerceFactory method getProduct.

public static Product getProduct(Resource resource) {
    Product product = mock(Product.class);
    when(product.getPath()).thenReturn(resource.getPath());
    Resource image = resource.getChild("image");
    if (image != null) {
        ImageResource imageResource = new ImageResource(image);
        when(product.getImage()).thenReturn(imageResource);
    }
    return product;
}
Also used : ImageResource(com.day.cq.commons.ImageResource) Resource(org.apache.sling.api.resource.Resource) ImageResource(com.day.cq.commons.ImageResource) Product(com.adobe.cq.commerce.api.Product)

Aggregations

Product (com.adobe.cq.commerce.api.Product)1 ImageResource (com.day.cq.commons.ImageResource)1 Resource (org.apache.sling.api.resource.Resource)1