@Test
public void testQueryWrappingMercatorSeparate() throws Exception {

    ReferencedEnvelope world = new ReferencedEnvelope(160, 180, -40, 40, WGS84);
    ReferencedEnvelope mercatorEnvelope = world.transform(MERCATOR, true);
    // move it so that it crosses the dateline
    mercatorEnvelope.translate(mercatorEnvelope.getWidth() / 2, 0);
    // get query area, we expect two separate query envelopes
    ProjectionHandler handler = ProjectionHandlerFinder.getHandler(mercatorEnvelope, WGS84, true);
    List<ReferencedEnvelope> envelopes = handler.getQueryEnvelopes();
    assertEquals(2, envelopes.size());
    ReferencedEnvelope reOrig = envelopes.get(0); // original
    assertEquals(170.0, reOrig.getMinX(), EPS);
    assertEquals(180.0, reOrig.getMaxX(), EPS);
    ReferencedEnvelope reAdded = envelopes.get(1); // added
    assertEquals(-180.0, reAdded.getMinX(), EPS);
    assertEquals(-170.0, reAdded.getMaxX(), EPS);
}