@Test public void testBuildUrlCornerCases() { try { new SimpleTmsUrlBuilder(null); Assert.fail(); } catch (IllegalStateException e) { } try { TileUrlBuilder builder = new SimpleTmsUrlBuilder("." + EXTENSION); builder.buildUrl(null, ""); Assert.fail(); } catch (NullPointerException e) { } try { TileUrlBuilder builder = new SimpleTmsUrlBuilder("." + EXTENSION); builder.buildUrl(new TileCode(), null); Assert.fail(); } catch (NullPointerException e) { } }
@Override public String buildUrl(TileCode tileCode, String baseTmsUrl) { StringBuilder builder = new StringBuilder(baseTmsUrl); if (!baseTmsUrl.endsWith("/")) { builder.append("/"); } builder.append(tileCode.getTileLevel()); builder.append("/"); builder.append(tileCode.getX()); builder.append("/"); builder.append(tileCode.getY()); builder.append(extension); return builder.toString(); }
SimpleTmsUrlBuilder implements TileUrlBuilder { @Override public String buildUrl(TileCode tileCode, String baseTmsUrl) { StringBuilder builder = new StringBuilder(baseTmsUrl); if (!baseTmsUrl.endsWith("/")) { builder.append("/"); } builder.append(tileCode.getTileLevel()); builder.append("/"); builder.append(tileCode.getX()); builder.append("/"); builder.append(tileCode.getY()); builder.append(extension); return builder.toString(); } }
SimpleTmsUrlBuilder implements TileUrlBuilder { @Override public String buildUrl(TileCode tileCode, String baseTmsUrl) { StringBuilder builder = new StringBuilder(baseTmsUrl); if (!baseTmsUrl.endsWith("/")) { builder.append("/"); } builder.append(tileCode.getTileLevel()); builder.append("/"); builder.append(tileCode.getX()); builder.append("/"); builder.append(tileCode.getY()); builder.append(extension); return builder.toString(); } SimpleTmsUrlBuilder(String extension); }
SimpleTmsUrlBuilder implements TileUrlBuilder { @Override public String buildUrl(TileCode tileCode, String baseTmsUrl) { StringBuilder builder = new StringBuilder(baseTmsUrl); if (!baseTmsUrl.endsWith("/")) { builder.append("/"); } builder.append(tileCode.getTileLevel()); builder.append("/"); builder.append(tileCode.getX()); builder.append("/"); builder.append(tileCode.getY()); builder.append(extension); return builder.toString(); } SimpleTmsUrlBuilder(String extension); @Override String buildUrl(TileCode tileCode, String baseTmsUrl); }
SimpleTmsUrlBuilder implements TileUrlBuilder { @Override public String buildUrl(TileCode tileCode, String baseTmsUrl) { StringBuilder builder = new StringBuilder(baseTmsUrl); if (!baseTmsUrl.endsWith("/")) { builder.append("/"); } builder.append(tileCode.getTileLevel()); builder.append("/"); builder.append(tileCode.getX()); builder.append("/"); builder.append(tileCode.getY()); builder.append(extension); return builder.toString(); } SimpleTmsUrlBuilder(String extension); @Override String buildUrl(TileCode tileCode, String baseTmsUrl);  }