use of com.nytimes.android.external.store3.base.impl.BarCode in project Store by NYTimes.
the class GetRefreshingTest method setUp.
@Before
public void setUp() {
networkCalls = new AtomicInteger(0);
store = StoreBuilder.<Integer>barcode().fetcher(barCode -> Single.fromCallable(() -> networkCalls.incrementAndGet())).persister(persister).open();
}
use of com.nytimes.android.external.store3.base.impl.BarCode in project Store by NYTimes.
the class SequentialTest method sequentially.
@Test
public void sequentially() {
BarCode b = new BarCode("one", "two");
store.get(b).test().awaitTerminalEvent();
store.get(b).test().awaitTerminalEvent();
assertThat(networkCalls).isEqualTo(1);
}
use of com.nytimes.android.external.store3.base.impl.BarCode in project Store by NYTimes.
the class SequentialTest method parallelWithResult.
@Test
public void parallelWithResult() {
BarCode b = new BarCode("one", "two");
Single<Result<Integer>> first = store.getWithResult(b);
Single<Result<Integer>> second = store.getWithResult(b);
first.test().awaitTerminalEvent();
second.test().awaitTerminalEvent();
assertThat(networkCalls).isEqualTo(1);
}
use of com.nytimes.android.external.store3.base.impl.BarCode in project Store by NYTimes.
the class SequentialTest method sequentiallyWithResult.
@Test
public void sequentiallyWithResult() {
BarCode b = new BarCode("one", "two");
store.getWithResult(b).test().awaitTerminalEvent();
store.getWithResult(b).test().awaitTerminalEvent();
assertThat(networkCalls).isEqualTo(1);
}
use of com.nytimes.android.external.store3.base.impl.BarCode in project Store by NYTimes.
the class NoopPersisterTest method writeReadTest.
@Test
public void writeReadTest() {
BarCode barCode = new BarCode("key", "value");
NoopPersister<String, BarCode> persister = NoopPersister.create();
boolean success = persister.write(barCode, "foo").blockingGet();
assertThat(success).isTrue();
String rawValue = persister.read(barCode).blockingGet();
assertThat(rawValue).isEqualTo("foo");
}
Aggregations