class 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();
	}

}

class SimpleTmsUrlBuilderTest {

	private static final String BASE_TMS_URL;
	private static final String EXTENSION;
	private static final String EXPECTED;

	@Test
	public void testBuildUrl1() {

		TileUrlBuilder builder = new SimpleTmsUrlBuilder(EXTENSION);
		String url = builder.buildUrl(new TileCode(1, 2, 3), BASE_TMS_URL);
		Assert.assertEquals(EXPECTED, url);
	}

}