Improve code / xml formatting, closes #54

This commit is contained in:
Emux
2016-07-09 19:45:22 +03:00
parent 7919d0ab9c
commit e793e8851b
458 changed files with 58405 additions and 63062 deletions

View File

@@ -1,7 +1,5 @@
package org.oscim.tiling.source.oscimap4;
import static org.fest.assertions.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -11,51 +9,53 @@ import org.oscim.tiling.source.LwHttp;
import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import static org.fest.assertions.api.Assertions.assertThat;
public class OSciMap4TileSourceTest {
private OSciMap4TileSource tileSource;
private OSciMap4TileSource tileSource;
@Before
public void setUp() throws Exception {
tileSource = new OSciMap4TileSource("http://www.example.org/tiles/vtm");
}
@Before
public void setUp() throws Exception {
tileSource = new OSciMap4TileSource("http://www.example.org/tiles/vtm");
}
@Test
public void shouldNotBeNull() throws Exception {
assertThat(tileSource).isNotNull();
}
@Test
public void shouldNotBeNull() throws Exception {
assertThat(tileSource).isNotNull();
}
@Test
public void shouldUseLwHttp() throws Exception {
LwHttp lwHttp = Mockito.mock(LwHttp.class);
tileSource.setHttpEngine(new TestHttpFactory(lwHttp));
ITileDataSource dataSource = tileSource.getDataSource();
dataSource.dispose();
Mockito.verify(lwHttp).close();
}
@Test
public void shouldUseLwHttp() throws Exception {
LwHttp lwHttp = Mockito.mock(LwHttp.class);
tileSource.setHttpEngine(new TestHttpFactory(lwHttp));
ITileDataSource dataSource = tileSource.getDataSource();
dataSource.dispose();
Mockito.verify(lwHttp).close();
}
@Test
public void shouldUseOkHttp() throws Exception {
OkHttpEngine okHttp = Mockito.mock(OkHttpEngine.class);
tileSource.setHttpEngine(new TestHttpFactory(okHttp));
ITileDataSource dataSource = tileSource.getDataSource();
dataSource.dispose();
Mockito.verify(okHttp).close();
}
@Test
public void shouldUseOkHttp() throws Exception {
OkHttpEngine okHttp = Mockito.mock(OkHttpEngine.class);
tileSource.setHttpEngine(new TestHttpFactory(okHttp));
ITileDataSource dataSource = tileSource.getDataSource();
dataSource.dispose();
Mockito.verify(okHttp).close();
}
/**
* Test factory that allows the specific {@link HttpEngine} instance to be
* set.
*/
class TestHttpFactory implements HttpEngine.Factory {
final HttpEngine engine;
/**
* Test factory that allows the specific {@link HttpEngine} instance to be
* set.
*/
class TestHttpFactory implements HttpEngine.Factory {
final HttpEngine engine;
public TestHttpFactory(HttpEngine engine) {
this.engine = engine;
}
public TestHttpFactory(HttpEngine engine) {
this.engine = engine;
}
@Override
public HttpEngine create(UrlTileSource tileSource) {
return engine;
}
}
@Override
public HttpEngine create(UrlTileSource tileSource) {
return engine;
}
}
}