mirror of
https://github.com/MinimalBible/MinimalBible
synced 2025-07-07 00:34:42 -04:00
Remove the "testing" mode
This commit is contained in:
@ -1,15 +1,21 @@
|
||||
package org.bspeice.minimalbible.test.activity.downloader.manager;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.bspeice.minimalbible.Injector;
|
||||
import org.bspeice.minimalbible.activity.downloader.manager.RefreshManager;
|
||||
import org.crosswire.jsword.book.Book;
|
||||
import org.crosswire.jsword.book.install.Installer;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -19,6 +25,7 @@ import dagger.ObjectGraph;
|
||||
import dagger.Provides;
|
||||
import rx.functions.Action1;
|
||||
|
||||
import static com.jayway.awaitility.Awaitility.await;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class RefreshManagerTest extends TestCase implements Injector {
|
||||
@ -113,9 +120,36 @@ public class RefreshManagerTest extends TestCase implements Injector {
|
||||
verify(mockInstaller).getBooks();
|
||||
}
|
||||
|
||||
/*
|
||||
public void testIsRefreshComplete() throws Exception {
|
||||
public void testRefreshSeparateThread() {
|
||||
Installer mockInstaller = mock(Installer.class);
|
||||
final List<Book> bookList = new ArrayList<Book>();
|
||||
when(mockInstaller.getBooks()).thenAnswer(new Answer<List<Book>>() {
|
||||
@Override
|
||||
public List<Book> answer(InvocationOnMock invocationOnMock) throws Throwable {
|
||||
Thread.sleep(1000); // Just long enough to give us a gap between
|
||||
// refresh start and complete
|
||||
return bookList;
|
||||
}
|
||||
});
|
||||
|
||||
Collection<Installer> mockInstallers = new ArrayList<Installer>();
|
||||
mockInstallers.add(mockInstaller);
|
||||
|
||||
RMTModules modules = new RMTModules(this, mockInstallers);
|
||||
mObjectGraph = ObjectGraph.create(modules);
|
||||
|
||||
// And the actual test
|
||||
mObjectGraph.inject(this);
|
||||
|
||||
// So the refresh should be kicked off at the constructor, meaning that it's not "complete"
|
||||
assertFalse(rM.isRefreshComplete());
|
||||
|
||||
// But, if it's on another thread, it should finish up eventually, right?
|
||||
await().atMost(5, TimeUnit.SECONDS).until(new Callable<Boolean>() {
|
||||
@Override
|
||||
public Boolean call() throws Exception {
|
||||
return rM.isRefreshComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user