ImageStyleImpl extends GeneralComposeable implements ImageStyle { @Override public boolean createPreview(String context) throws IllegalArgumentException { if (StringUtils.isBlank(context)) throw new IllegalArgumentException("Context must not be blank"); if (contexts == null || contexts.isEmpty()) return false; if ("all".equals(contexts.get(0).getResource())) return contexts.get(0).createPreview(); for (Context ctx : contexts) { if (context.equals(ctx.getResource())) return ctx.createPreview(); } return false; } ImageStyleImpl(String id, int width, int height,
      ImageScalingMode scaling, boolean composeable, boolean preview);  ImageStyleImpl(String id, int width, int height);  ImageStyleImpl(String id, ImageScalingMode mode);  ImageStyleImpl(String id); void addContext(String type, boolean preview); @Override List<String> getContexts(); @Override boolean createPreview(String context); float scale(int width, int height); void setScalingMode(ImageScalingMode mode); ImageScalingMode getScalingMode(); void setHeight(int height); int getHeight(); void setWidth(int width); int getWidth(); @Override int hashCode(); @Override boolean equals(Object o); static ImageStyleImpl fromXml(Node node); static ImageStyleImpl fromXml(Node node, XPath xpath); String toXml(); @Override String toString(); static final String GLOBAL_CONTEXT; }
@Test public void testIsPreview() { assertEquals(createPreviewsForPages, imageStyle.createPreview(pageContext)); assertEquals(createPreviewsForImages, imageStyle.createPreview(imageContext)); }