mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-21 23:48:18 -05:00
Strange errors in Robolectric land...
This commit is contained in:
parent
f331f95722
commit
9e63885984
@ -15,16 +15,19 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def androidModule = project(':app')
|
def androidModule = project(':app')
|
||||||
def firstVariant = androidModule.android.applicationVariants.toList().first()
|
def firstAppVariant = androidModule.android.applicationVariants.toList().first()
|
||||||
|
//def firstTestVariant = androidModule.android.testVariants.toList().first()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile androidModule
|
compile androidModule
|
||||||
|
|
||||||
testCompile firstVariant.javaCompile.classpath
|
testCompile firstAppVariant.javaCompile.classpath
|
||||||
testCompile firstVariant.javaCompile.outputs.files
|
testCompile firstAppVariant.javaCompile.outputs.files
|
||||||
|
//testCompile firstTestVariant.javaCompile.outputs.files
|
||||||
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
|
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
|
||||||
|
|
||||||
testCompile 'junit:junit:4.+'
|
testCompile 'junit:junit:4.+'
|
||||||
|
testCompile 'org.mockito:mockito-all:+'
|
||||||
testCompile 'org.robolectric:robolectric:+'
|
testCompile 'org.robolectric:robolectric:+'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,11 +45,11 @@ jacocoTestReport {
|
|||||||
def jacocoExcludes = [
|
def jacocoExcludes = [
|
||||||
"android/**/*"
|
"android/**/*"
|
||||||
]
|
]
|
||||||
firstVariant.javaCompile.exclude(jacocoExcludes).outputs.files
|
firstAppVariant.javaCompile.exclude(jacocoExcludes).outputs.files
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
sourceDirectories = files(androidModule.android.sourceSets.main.java.srcDirs)
|
sourceDirectories = files(androidModule.android.sourceSets.main.java.srcDirs)
|
||||||
classDirectories = firstVariant.javaCompile.outputs.files
|
classDirectories = firstAppVariant.javaCompile.outputs.files
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back to your regularly scheduled Jacoco
|
// Back to your regularly scheduled Jacoco
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package org.bspeice.minimalbible.test.activity.downloader;
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.activity.downloader.BookListFragment;
|
||||||
|
import org.bspeice.minimalbible.activity.downloader.DownloadActivity;
|
||||||
|
import org.crosswire.jsword.book.BookCategory;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.Robolectric;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by bspeice on 11/17/14.
|
||||||
|
*/
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(emulateSdk = 18, manifest = "../app/src/main/AndroidManifest.xml")
|
||||||
|
public class BookListFragmentTest {
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
DownloadActivity activity = Robolectric.buildActivity(DownloadActivity.class)
|
||||||
|
.create().start().visible().get();
|
||||||
|
BookListFragment fragment = BookListFragment.newInstance(BookCategory.BIBLE);
|
||||||
|
activity.getSupportFragmentManager()
|
||||||
|
.beginTransaction()
|
||||||
|
.add(fragment, null)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testItsWorking() {
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user