move tests to separate project

This commit is contained in:
Hannes Janetzek 2014-03-29 12:54:12 +01:00
parent f75702a575
commit 2bf5313c2b
7 changed files with 24 additions and 13 deletions

View File

@ -1,4 +1,5 @@
include ':vtm'
include ':vtm-tests'
include ':vtm-extras'
include ':vtm-android'
include ':vtm-android-example'

15
vtm-tests/build.gradle Normal file
View File

@ -0,0 +1,15 @@
apply plugin: 'java'
apply plugin: 'maven'
dependencies {
compile project(':vtm')
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.easytesting:fest-assert-core:2.0M10'
testCompile 'com.squareup.okhttp:mockwebserver:1.5.2'
}
sourceSets {
main.java.srcDirs = ['src']
test.java.srcDirs = ['test']
}

View File

@ -1,13 +1,13 @@
package org.oscim.tiling.source.bitmap;
import static org.fest.assertions.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.oscim.tiling.ITileDataSource;
import org.oscim.tiling.source.LwHttp;
import org.oscim.tiling.source.OkHttpEngine;
import static org.fest.assertions.api.Assertions.assertThat;
import org.oscim.tiling.source.OkHttpEngine.OkHttpFactory;
import org.oscim.tiling.source.UrlTileDataSource;
public class BitmapTileSourceTest {
private BitmapTileSource tileSource;
@ -24,7 +24,7 @@ public class BitmapTileSourceTest {
@Test
public void shouldUseLwHttp() throws Exception {
LwHttp lwHttp = Mockito.mock(LwHttp.class);
LwHttpFactory lwHttp = Mockito.mock(LwHttpFactory.class);
tileSource.setHttpEngine(lwHttp);
ITileDataSource dataSource = tileSource.getDataSource();
dataSource.destroy();
@ -33,11 +33,11 @@ public class BitmapTileSourceTest {
@Test
public void shouldUseOkHttp() throws Exception {
OkHttpEngine okHttp = Mockito.mock(OkHttpEngine.class);
OkHttpFactory okHttp = Mockito.mock(OkHttpFactory.class);
tileSource.setHttpEngine(okHttp);
ITileDataSource dataSource = tileSource.getDataSource();
UrlTileDataSource dataSource = (UrlTileDataSource) tileSource.getDataSource();
dataSource.destroy();
Mockito.verify(okHttp).close();
//Mockito.verify(dataSource.mConn).close();
}
class TestBitmapTileSource extends BitmapTileSource {

View File

@ -7,15 +7,10 @@ dependencies {
compile 'org.slf4j:slf4j-api:1.7.6'
compile 'com.squareup.okhttp:okhttp:1.5.2'
providedCompile 'com.google.code.findbugs:annotations:2.0.1'
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.easytesting:fest-assert-core:2.0M10'
testCompile 'com.squareup.okhttp:mockwebserver:1.5.2'
}
sourceSets {
main.java.srcDirs = ['src']
test.java.srcDirs = ['test']
main.resources.srcDirs = ['resources']
main.compileClasspath += configurations.providedCompile
}