layers.add(ftInfo.getFeatureType());
CoverageInfo cInfo = getCatalog().getCoverageByName("world");
assertNotNull(cInfo);
GridCoverage coverage = cInfo.getGridCoverage(null, null);
try {
SimpleFeatureCollection feature;
feature = FeatureUtilities.wrapGridCoverage((GridCoverage2D) coverage);
layers.add(feature.getSchema());
req.setLayers(layers);
List<Style> styles=new ArrayList<Style>();
Style style1= getCatalog().getStyleByName(
MockData.ROAD_SEGMENTS.getLocalPart()).getStyle();
styles.add(style1);
Style style2= getCatalog().getStyleByName("rainfall").getStyle();
styles.add(style2);
req.setStyles(styles);
this.legendProducer.buildLegendGraphic(req);
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
// vector layer
assertPixel(image, 10, 10+titleHeight, new Color(192,160,0));
assertPixel(image, 10, 30+titleHeight, new Color(0,0,0));
assertPixel(image, 10, 50+titleHeight, new Color(224,64,0));
// coverage layer
assertPixel(image, 10, 70+titleHeight*2, new Color(115,38,0));
} finally {
RenderedImage ri = coverage.getRenderedImage();
if(coverage instanceof GridCoverage2D) {
((GridCoverage2D) coverage).dispose(true);
}
if(ri instanceof PlanarImage) {
ImageUtilities.disposePlanarImageChain((PlanarImage) ri);