TileMapUrlBuilder implements TileUrlBuilder { @Override public String buildUrl(TileCode tileCode, String baseTmsUrl) { return buildUrl(tileCode, tileMap, baseTmsUrl); } TileMapUrlBuilder(TileMap tileMap); @Override String buildUrl(TileCode tileCode, String baseTmsUrl); static String resolveProxyUrl(String relativeUrl, TileMap tileMap, String baseTmsUrl); static TileCode parseTileCode(String relativeUrl);  }
@Test public void testBuildUrl1() throws TmsLayerException { TmsLayer tmsLayer = new TmsLayer(); tmsLayer.setBaseTmsUrl("classpath:/org/geomajas/layer/tms/tileMapCapa1.xml"); TileMap tileMap = configurationService .getCapabilities(tmsLayer); TileMapUrlBuilder builder = new TileMapUrlBuilder(tileMap); String url = builder.buildUrl(new TileCode(1, 2, 3), BASE_TMS_URL); Assert.assertEquals("http: }
@Test public void testBuildUrl2() throws TmsLayerException { TmsLayer tmsLayer = new TmsLayer(); tmsLayer.setBaseTmsUrl("classpath:/org/geomajas/layer/tms/tileMapCapa2.xml"); TileMap tileMap = configurationService .getCapabilities(tmsLayer); TileMapUrlBuilder builder = new TileMapUrlBuilder(tileMap); String url = builder.buildUrl(new TileCode(1, 2, 3), BASE_TMS_URL); Assert.assertEquals("http: }
@Test public void testBuildUrlCornerCases() throws TmsLayerException { try { new TileMapUrlBuilder(null); Assert.fail(); } catch (IllegalStateException e) { } TmsLayer tmsLayer = new TmsLayer(); tmsLayer.setBaseTmsUrl("classpath:/org/geomajas/layer/tms/tileMapCapa2.xml"); TileMap tileMap = configurationService .getCapabilities(tmsLayer); TileMapUrlBuilder builder = new TileMapUrlBuilder(tileMap); try { builder.buildUrl(null, BASE_TMS_URL); Assert.fail(); } catch (IllegalArgumentException e) { } try { builder.buildUrl(new TileCode(), null); Assert.fail(); } catch (IllegalArgumentException e) { } }