@Test
public void ignoreInteriorBoundariesBetweenRegions() throws Exception {

    final float[][] DATA = {
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        {0, 1, 1, 1, 2, 2, 2, 3, 3, 0},
        {0, 1, 1, 1, 2, 2, 2, 3, 3, 0},
        {0, 1, 1, 1, 2, 2, 2, 3, 3, 0},
        {0, 4, 4, 5, 5, 5, 6, 6, 6, 0},
        {0, 4, 4, 5, 5, 5, 6, 6, 6, 0},
        {0, 4, 4, 5, 5, 5, 6, 6, 6, 0},
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    };
    final int width = DATA[0].length;
    final int height = DATA.length;
    GridCoverage2D cov = covFactory.create(
            "coverage",
            DATA,
            new ReferencedEnvelope(0, width, 0, height, null));
    SimpleFeatureCollection fc = process.execute(cov, 0, Boolean.FALSE, null, null, null, null);
    assertEquals(1, fc.size());
    Geometry geom = (Geometry) fc.features().next().getDefaultGeometry();
    Envelope env = geom.getEnvelopeInternal();
    assertEquals(new Envelope(1, width-1, 1, height-1), env);
}