mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Shifted the ApacheHttpClientMediaWikiApiTest to run using Robolectric (as a unit test) rather than on-device.
This commit is contained in:
parent
c035b368c4
commit
ddce34bc90
2 changed files with 10 additions and 7 deletions
|
|
@ -28,6 +28,11 @@ dependencies {
|
||||||
compile "com.google.guava:guava:${GUAVA_VERSION}"
|
compile "com.google.guava:guava:${GUAVA_VERSION}"
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
testCompile ('org.robolectric:robolectric:3.3.2') {
|
||||||
|
exclude module: 'guava'
|
||||||
|
}
|
||||||
|
|
||||||
|
testCompile 'com.squareup.okhttp3:mockwebserver:3.8.1'
|
||||||
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.8.1'
|
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.8.1'
|
||||||
androidTestCompile "com.android.support:support-annotations:${project.supportLibVersion}"
|
androidTestCompile "com.android.support:support-annotations:${project.supportLibVersion}"
|
||||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
package fr.free.nrw.commons.mwapi;
|
package fr.free.nrw.commons.mwapi;
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
@ -25,11 +26,8 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/*
|
@RunWith(RobolectricTestRunner.class)
|
||||||
* XML for individual tests was captured by hand from the API sandbox -
|
@Config(constants = BuildConfig.class)
|
||||||
* https://en.wikipedia.org/wiki/Special:ApiSandbox
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class ApacheHttpClientMediaWikiApiTest {
|
public class ApacheHttpClientMediaWikiApiTest {
|
||||||
|
|
||||||
private ApacheHttpClientMediaWikiApi testObject;
|
private ApacheHttpClientMediaWikiApi testObject;
|
||||||
|
|
@ -226,4 +224,4 @@ public class ApacheHttpClientMediaWikiApiTest {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue