Improve code / xml formatting, closes #54
This commit is contained in:
@@ -16,64 +16,64 @@
|
||||
*/
|
||||
package org.oscim.tiling.source;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
|
||||
public class UrlTileSourceTest {
|
||||
private UrlTileSource tileSource;
|
||||
private UrlTileSource tileSource;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
tileSource = new TestTileSource("http://example.org/tiles/vtm", "/{Z}/{X}/{Z}.vtm");
|
||||
}
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
tileSource = new TestTileSource("http://example.org/tiles/vtm", "/{Z}/{X}/{Z}.vtm");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setApiKey_shouldAppendApiKey() throws Exception {
|
||||
tileSource.setApiKey("testkey");
|
||||
assertThat(tileSource.getTileUrl(new Tile(0, 0, (byte) 0))).endsWith("?api_key=testkey");
|
||||
}
|
||||
@Test
|
||||
public void setApiKey_shouldAppendApiKey() throws Exception {
|
||||
tileSource.setApiKey("testkey");
|
||||
assertThat(tileSource.getTileUrl(new Tile(0, 0, (byte) 0))).endsWith("?api_key=testkey");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotBeNull() throws Exception {
|
||||
assertThat(tileSource).isNotNull();
|
||||
}
|
||||
@Test
|
||||
public void shouldNotBeNull() throws Exception {
|
||||
assertThat(tileSource).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldUseDefaultHttpEngine() throws Exception {
|
||||
TestTileDataSource dataSource = (TestTileDataSource) tileSource.getDataSource();
|
||||
assertThat(dataSource.getConnection()).isInstanceOf(LwHttp.class);
|
||||
}
|
||||
@Test
|
||||
public void shouldUseDefaultHttpEngine() throws Exception {
|
||||
TestTileDataSource dataSource = (TestTileDataSource) tileSource.getDataSource();
|
||||
assertThat(dataSource.getConnection()).isInstanceOf(LwHttp.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldUseCustomHttpEngine() throws Exception {
|
||||
tileSource.setHttpEngine(new OkHttpEngine.OkHttpFactory());
|
||||
TestTileDataSource dataSource = (TestTileDataSource) tileSource.getDataSource();
|
||||
assertThat(dataSource.getConnection()).isInstanceOf(OkHttpEngine.class);
|
||||
}
|
||||
@Test
|
||||
public void shouldUseCustomHttpEngine() throws Exception {
|
||||
tileSource.setHttpEngine(new OkHttpEngine.OkHttpFactory());
|
||||
TestTileDataSource dataSource = (TestTileDataSource) tileSource.getDataSource();
|
||||
assertThat(dataSource.getConnection()).isInstanceOf(OkHttpEngine.class);
|
||||
}
|
||||
|
||||
class TestTileSource extends UrlTileSource {
|
||||
public TestTileSource(String urlString, String tilePath) {
|
||||
super(urlString, tilePath);
|
||||
}
|
||||
class TestTileSource extends UrlTileSource {
|
||||
public TestTileSource(String urlString, String tilePath) {
|
||||
super(urlString, tilePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new TestTileDataSource(this, null, getHttpEngine());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new TestTileDataSource(this, null, getHttpEngine());
|
||||
}
|
||||
}
|
||||
|
||||
class TestTileDataSource extends UrlTileDataSource {
|
||||
public TestTileDataSource(UrlTileSource tileSource, ITileDecoder tileDecoder,
|
||||
HttpEngine conn) {
|
||||
super(tileSource, tileDecoder, conn);
|
||||
}
|
||||
class TestTileDataSource extends UrlTileDataSource {
|
||||
public TestTileDataSource(UrlTileSource tileSource, ITileDecoder tileDecoder,
|
||||
HttpEngine conn) {
|
||||
super(tileSource, tileDecoder, conn);
|
||||
}
|
||||
|
||||
public HttpEngine getConnection() {
|
||||
return mConn;
|
||||
}
|
||||
}
|
||||
public HttpEngine getConnection() {
|
||||
return mConn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user