use of io.reark.rxgithubapp.shared.pojo.GitHubRepository in project reark by reark.
the class GitHubRepositoryStoreTest method getOne_WithData_ReturnsData_AndCompletes.
@Test
public void getOne_WithData_ReturnsData_AndCompletes() throws InterruptedException {
final GitHubRepository value = create(100, "repository1");
// TODO synchronous init with contentProvider
gitHubRepositoryStore.put(value);
Thread.sleep(Constants.Tests.PROVIDER_WAIT_TIME);
// getOnce is expected to return a observable that emits the value and then completes.
gitHubRepositoryStore.getOnce(100).subscribe(testSubscriber);
testSubscriber.awaitTerminalEvent(Constants.Tests.PROVIDER_WAIT_TIME, TimeUnit.MILLISECONDS);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(singletonList(value));
}
use of io.reark.rxgithubapp.shared.pojo.GitHubRepository in project reark by reark.
the class GitHubRepositoryStoreTest method getOnceAndStream_ReturnsAllValuesForSubscribedId_AndDoesNotComplete.
@Test
public void getOnceAndStream_ReturnsAllValuesForSubscribedId_AndDoesNotComplete() throws InterruptedException {
final GitHubRepository value1 = create(100, "repository-1");
final GitHubRepository value2 = create(100, "repository-2");
final GitHubRepository value3 = create(100, "repository-3");
gitHubRepositoryStore.getOnceAndStream(100).subscribe(testSubscriber);
Thread.sleep(Constants.Tests.PROVIDER_WAIT_TIME);
gitHubRepositoryStore.put(value1);
Thread.sleep(Constants.Tests.PROVIDER_WAIT_TIME);
gitHubRepositoryStore.put(value2);
Thread.sleep(Constants.Tests.PROVIDER_WAIT_TIME);
gitHubRepositoryStore.put(value3);
testSubscriber.awaitTerminalEvent(Constants.Tests.PROVIDER_WAIT_TIME, TimeUnit.MILLISECONDS);
testSubscriber.assertNotCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(asList(none(), value1, value2, value3));
}
use of io.reark.rxgithubapp.shared.pojo.GitHubRepository in project reark by reark.
the class GitHubRepositoryStoreCoreTest method getStream_DoesNotEmitInitialValue.
@Test
public void getStream_DoesNotEmitInitialValue() {
final GitHubRepository value = create(100, "test name");
TestSubscriber<GitHubRepository> testSubscriber = new TestSubscriber<>();
gitHubRepositoryStoreCore.put(100, value);
gitHubRepositoryStoreCore.getStream(100).subscribe(testSubscriber);
gitHubRepositoryStoreCore.put(100, value);
testSubscriber.awaitTerminalEvent(Constants.Tests.PROVIDER_WAIT_TIME, TimeUnit.MILLISECONDS);
testSubscriber.assertNotCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertValue(value);
}
use of io.reark.rxgithubapp.shared.pojo.GitHubRepository in project reark by reark.
the class GitHubRepositoryStoreCoreTest method getAllCached_ReturnsAllData_AndCompletes.
// GET ALL CACHED
@Test
public void getAllCached_ReturnsAllData_AndCompletes() throws InterruptedException {
// ARRANGE
final GitHubRepository value1 = create(100, "test name 1");
final GitHubRepository value2 = create(200, "test name 2");
final GitHubRepository value3 = create(300, "test name 3");
TestSubscriber<List<GitHubRepository>> testSubscriber = new TestSubscriber<>();
// ACT
gitHubRepositoryStoreCore.put(100, value1);
gitHubRepositoryStoreCore.put(200, value2);
Thread.sleep(Constants.Tests.PROVIDER_WAIT_TIME);
gitHubRepositoryStoreCore.getAllCached().subscribe(testSubscriber);
gitHubRepositoryStoreCore.put(300, value3);
// ASSERT
testSubscriber.awaitTerminalEvent(Constants.Tests.PROVIDER_WAIT_TIME, TimeUnit.MILLISECONDS);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertValue(asList(value1, value2));
}
Aggregations