mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-04 23:28:19 -05:00
Remove a PoC test case, and make sure all tests are successful.
This commit is contained in:
parent
099c7ec02a
commit
e7cf3be6bc
@ -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<DownloadActivity> {
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
@ -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<BookCategory> provideValidCategories() {
|
||||
return new ArrayList<BookCategory>() {{
|
||||
add(BookCategory.BIBLE);
|
||||
add(BookCategory.COMMENTARY);
|
||||
add(BookCategory.DICTIONARY);
|
||||
add(BookCategory.MAPS);
|
||||
}};
|
||||
}
|
||||
|
||||
private boolean isTest;
|
||||
|
||||
public void setTestMode(boolean isTest) {
|
||||
|
Loading…
Reference in New Issue
Block a user