@Test
public void testNormalSeveral() throws Exception {

	// move up north to test latlon flattening
	Envelope googleEnvelope = new Envelope(10000, 11000, 6005000, 6006000);
	// back-transform envelope to latlon
	Crs google = geoService.getCrs2(MERCATOR);
	Crs latlon = geoService.getCrs2(LONLAT);
	Envelope latlonEnvelope = geoService.transform(JTS.toGeometry(googleEnvelope), google, latlon)
			.getEnvelopeInternal();
	// back-transform scale to latlon
	double latlonScale = MAX_LEVEL_SCALE * googleEnvelope.getWidth() / latlonEnvelope.getWidth();
	// paint with re-projection (affine is fine for now...:-)
	List<RasterTile> tiles = wms.paint(latlon, latlonEnvelope, latlonScale);
	// Assert.assertEquals(4, tiles.size());
	Assert.assertEquals(2, tiles.size());
	Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&WIDTH=512&"
			+ "HEIGHT=512&bbox=0.0859375,47.3828125,0.09375,47.390625&format=image/jpeg&version=1.1.1&"
			+ "srs=EPSG%3A4326&styles=&request=GetMap", tiles.get(0).getUrl());
	Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&WIDTH=512&"
			+ "HEIGHT=512&bbox=0.09375,47.3828125,0.1015625,47.390625&format=image/jpeg&version=1.1.1&"
			+ "srs=EPSG%3A4326&styles=&request=GetMap", tiles.get(1).getUrl());
	RasterTile tile = tiles.get(1);
	Assert.assertEquals(16, tile.getCode().getTileLevel());
	Assert.assertEquals(23052, tile.getCode().getX());
	Assert.assertEquals(58801, tile.getCode().getY());
	Assert.assertEquals(4174.0, tile.getBounds().getX(), DELTA);
	Assert.assertEquals(-2110200.0, tile.getBounds().getY(), DELTA);
	Assert.assertEquals(348.0, tile.getBounds().getHeight(), DELTA);
	Assert.assertEquals(348.0, tile.getBounds().getWidth(), DELTA);
	// Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
	// + "WIDTH=512&HEIGHT=512&bbox=0.08895567100992707,47.37804639974752,0.09677101398176689,"
	// + "47.38586174271936&format=image/jpeg&version=1.1.1&srs=EPSG%3A4326&styles=&request=GetMap", tiles
	// .get(0).getUrl());
	// Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
	// + "WIDTH=512&HEIGHT=512&bbox=0.08895567100992707,47.38586174271936,0.09677101398176689,"
	// + "47.393677085691195&format=image/jpeg&version=1.1.1&srs=EPSG%3A4326&styles=&request=GetMap",
	// tiles.get(1).getUrl());
	// Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
	// + "WIDTH=512&HEIGHT=512&bbox=0.09677101398176689,47.37804639974752,0.10458635695360671,"
	// + "47.38586174271936&format=image/jpeg&version=1.1.1&srs=EPSG%3A4326&styles=&request=GetMap", tiles
	// .get(2).getUrl());
	// Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
	// + "WIDTH=512&HEIGHT=512&bbox=0.09677101398176689,47.38586174271936,0.10458635695360671,"
	// + "47.393677085691195&format=image/jpeg&version=1.1.1&srs=EPSG%3A4326&styles=&request=GetMap",
	// tiles.get(3).getUrl());
	// RasterTile tile = tiles.get(3);
	// // MAX_LEVEL_SCALE 0.4 corresponds to level 16 with current algorithm !!!!
	// Assert.assertEquals(16, tile.getCode().getTileLevel());
	// Assert.assertEquals(23044, tile.getCode().getX());
	// Assert.assertEquals(58780, tile.getCode().getY());
	// Assert.assertEquals(4309.0, tile.getBounds().getX(), DELTA);
	// Assert.assertEquals(-2110336.0, tile.getBounds().getY(), DELTA);
	// Assert.assertEquals(348.0, tile.getBounds().getHeight(), DELTA);
	// Assert.assertEquals(348.0, tile.getBounds().getWidth(), DELTA);
}