@Test
  public void testForceCoverage() throws Exception {
    // force the data to another projection
    Catalog catalog = getCatalog();
    CoverageInfo ci = catalog.getCoverageByName("usa");
    ci.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED);
    ci.setSRS("EPSG:3857");
    catalog.save(ci);

    ci = catalog.getCoverageByName("usa");
    assertEquals(ProjectionPolicy.FORCE_DECLARED, ci.getProjectionPolicy());
    assertEquals("EPSG:3857", ci.getSRS());

    // now get the reader via the coverage info
    AbstractGridCoverage2DReader r;
    r = (AbstractGridCoverage2DReader) ci.getGridCoverageReader(null, GeoTools.getDefaultHints());
    assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:3857"), r.getCrs()));

    // and again without any hint
    r = (AbstractGridCoverage2DReader) ci.getGridCoverageReader(null, null);
    assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:3857"), r.getCrs()));

    // get the reader straight: we should get back the native projection
    CoverageStoreInfo store = catalog.getCoverageStoreByName("usa");
    final ResourcePool rpool = catalog.getResourcePool();
    r =
        (AbstractGridCoverage2DReader)
            rpool.getGridCoverageReader(store, GeoTools.getDefaultHints());
    assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), r.getCrs()));
  }
 public DecoratingGridCoverage2DReader(AbstractGridCoverage2DReader delegate) {
   this.delegate = delegate;
   this.crs = delegate.getCrs();
   this.originalEnvelope = delegate.getOriginalEnvelope();
   this.originalGridRange = delegate.getOriginalGridRange();
 }