* </p>
*/
@SuppressWarnings("unchecked")
private RenderedImage forceRenderingError(final Exception renderExceptionToThrow) throws Exception {
final WMSMapContext map = new WMSMapContext();
map.setMapWidth(100);
map.setMapHeight(100);
map.setRequest(new GetMapRequest(getWMS()));
final ReferencedEnvelope bounds = new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84);
map.setAreaOfInterest(bounds);
final FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeByName(STREAMS.getNamespaceURI(), STREAMS.getLocalPart());
final FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) ftInfo.getFeatureSource(null, null);
DecoratingFeatureSource<SimpleFeatureType, SimpleFeature> source;
// This source should make the renderer fail when asking for the features
source = new DecoratingFeatureSource<SimpleFeatureType, SimpleFeature>(featureSource) {
@Override
public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatures(Query query)
throws IOException {
throw new RuntimeException(renderExceptionToThrow);
// return delegate.getFeatures(query);
}
};
StyleInfo someStyle = getCatalog().getStyles().get(0);
map.addLayer(source, someStyle.getStyle());
this.rasterMapProducer.setOutputFormat(getMapFormat());
this.rasterMapProducer.setMapContext(map);
this.rasterMapProducer.produceMap();
return this.rasterMapProducer.getImage();