From e7cf3be6bcc71b8185431d7c5e509631b31af597 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Wed, 9 Jul 2014 21:20:52 -0400 Subject: [PATCH] Remove a PoC test case, and make sure all tests are successful. --- .../minimalbible/DownloadActivityTest.java | 40 ------------------- .../org/bspeice/minimalbible/TestModules.java | 17 +++++++- 2 files changed, 16 insertions(+), 41 deletions(-) delete mode 100644 app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java diff --git a/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java b/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java deleted file mode 100644 index 9e57380..0000000 --- a/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.bspeice.minimalbible; - -import android.test.ActivityInstrumentationTestCase2; - -import org.bspeice.minimalbible.activity.downloader.DownloadActivity; - -import java.lang.reflect.Field; - -/** - * Created by Bradlee Speice on 7/5/2014. - */ -/* Please note that it is necessary to extend the ActivityInstrumentationTestCase2 if you plan - on using an activity that sets up any underlying fragments (includes navigation drawers). - The ActivityUnitTestCase doesn't set up enough of the Activity lifecycle. - */ -public class DownloadActivityTest extends - ActivityInstrumentationTestCase2 { - - public DownloadActivityTest() { - super(DownloadActivity.class); - } - - public void testAndroidTestInjection() { - DownloadActivity a = getActivity(); - assertNotNull(a); - - Class c = a.getClass(); - try { - // getField() is public-only - Field fTitle = c.getDeclaredField("testInject"); - fTitle.setAccessible(true); - CharSequence title = (CharSequence)fTitle.get(a); - assertEquals(TestModules.testActivityTitle, title); - } catch (NoSuchFieldException e) { - fail(e.getMessage()); - } catch (IllegalAccessException e) { - fail(e.getMessage()); - } - } -} diff --git a/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java b/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java index ec1ac02..560b4b5 100644 --- a/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java +++ b/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java @@ -2,8 +2,13 @@ package org.bspeice.minimalbible; import org.bspeice.minimalbible.activity.downloader.DownloadActivity; +import org.crosswire.jsword.book.BookCategory; + +import java.util.ArrayList; +import java.util.List; import javax.inject.Named; +import javax.inject.Singleton; import dagger.Module; import dagger.Provides; @@ -13,7 +18,6 @@ import dagger.Provides; */ @Module(injects = DownloadActivity.class, overrides = true, - complete = false, library = true) public class TestModules { @@ -35,6 +39,17 @@ public class TestModules { return isTest; } + @Provides @Singleton + @Named("ValidCategories") + List provideValidCategories() { + return new ArrayList() {{ + add(BookCategory.BIBLE); + add(BookCategory.COMMENTARY); + add(BookCategory.DICTIONARY); + add(BookCategory.MAPS); + }}; + } + private boolean isTest; public void setTestMode(boolean isTest) {