@Test
public void testGetMapNoContentType() throws Exception {

    // reset the CRS system to its defaults
    System.clearProperty("org.geotools.referencing.forceXY");
    Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "");
    CRS.reset("all");
    // prepare the responses
    final AtomicBoolean disposeCalled = new AtomicBoolean(false);
    MockHttpClient client = new MockHttpClient() {
        public HTTPResponse get(URL url) throws IOException {
            if (url.getQuery().contains("GetCapabilities")) {
                URL caps130 = WMSCoverageReaderTest.class.getResource("caps130.xml");
                return new MockHttpResponse(caps130, "text/xml");
            } else if (url.getQuery().contains("GetMap")
                    && url.getQuery().contains("world4326")) {
                Map<String, String> params = parseParams(url.getQuery());
                assertEquals("1.3.0", params.get("VERSION"));
                assertEquals("-90.0,-180.0,90.0,180.0", params.get("BBOX"));
                assertEquals("EPSG:4326", params.get("CRS"));
                URL world = WMSCoverageReaderTest.class.getResource("world.png");
                return new MockHttpResponse(world, null) {
                    public void dispose() {
                        disposeCalled.set(true);
                        super.dispose();
                    };
                };
            } else {
                throw new IllegalArgumentException(
                        "Don't know how to handle a get request over " + url.toExternalForm());
            }
        }
    };
    // setup the reader
    WebMapServer server = new WebMapServer(new URL("http://geoserver.org/geoserver/wms"),
            client);
    WMSCoverageReader reader = new WMSCoverageReader(server, getLayer(server, "world4326"));
    // build a getmap request and check it
    CoordinateReferenceSystem wgs84 = CRS.decode("urn:ogc:def:crs:EPSG::4326", true);
    ReferencedEnvelope worldEnvelope = new ReferencedEnvelope(-90, 90, -180, 180, wgs84);
    GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(0, 0, 180, 90), worldEnvelope);
    final Parameter<GridGeometry2D> ggParam = (Parameter<GridGeometry2D>) AbstractGridFormat.READ_GRIDGEOMETRY2D
            .createValue();
    ggParam.setValue(gg);
    try {
        reader.read(new GeneralParameterValue[] { ggParam });
        fail("Should have thrown an exception, the GetMap content type was null");
    } catch (Exception e) {
        // it's fine
    }
    assertTrue(disposeCalled.get());
}