use of com.nytimes.android.external.store3.base.Persister in project Store by NYTimes.
the class MoshiSourceParserTest method testSourceParser.
@Test
public void testSourceParser() throws Exception {
Parser<BufferedSource, Foo> parser = MoshiParserFactory.createSourceParser(Foo.class);
Store<Foo, BarCode> store = ParsingStoreBuilder.<BufferedSource, Foo>builder().persister(persister).fetcher(fetcher).parser(parser).open();
Foo result = store.get(barCode).blockingGet();
assertEquals(result.number, 123);
assertEquals(result.string, "abc");
assertEquals(result.bars.size(), 2);
assertEquals(result.bars.get(0).string, "def");
assertEquals(result.bars.get(1).string, "ghi");
verify(fetcher, times(1)).fetch(barCode);
}
Aggregations