use of com.fasterxml.jackson.core.JsonFactory in project Store by NYTimes.
the class JacksonReaderParserStoreTest method testCustomJsonFactoryReaderParser.
@Test
public void testCustomJsonFactoryReaderParser() {
JsonFactory jsonFactory = new JsonFactory();
Parser<Reader, Foo> parser = JacksonParserFactory.createReaderParser(jsonFactory, Foo.class);
Store<Foo, BarCode> store = StoreBuilder.<BarCode, Reader, Foo>parsedWithKey().persister(persister).fetcher(fetcher).parser(parser).open();
Foo result = store.get(barCode).toBlocking().first();
validateFoo(result);
verify(fetcher, times(1)).fetch(barCode);
}
use of com.fasterxml.jackson.core.JsonFactory in project Store by NYTimes.
the class JacksonSourceParserStoreTest method testCustomJsonFactorySourceParser.
@Test
public void testCustomJsonFactorySourceParser() {
JsonFactory jsonFactory = new JsonFactory();
Parser<BufferedSource, Foo> parser = JacksonParserFactory.createSourceParser(jsonFactory, Foo.class);
Store<Foo, BarCode> store = StoreBuilder.<BarCode, BufferedSource, Foo>parsedWithKey().persister(persister).fetcher(fetcher).parser(parser).open();
Foo result = store.get(barCode).toBlocking().first();
validateFoo(result);
verify(fetcher, times(1)).fetch(barCode);
}
use of com.fasterxml.jackson.core.JsonFactory in project Store by NYTimes.
the class JacksonSourceParserStoreTest method testNullTypeWithValidJsonFactory.
@Test
public void testNullTypeWithValidJsonFactory() {
expectedException.expect(NullPointerException.class);
JacksonParserFactory.createStringParser(new JsonFactory(), null);
}
use of com.fasterxml.jackson.core.JsonFactory in project Store by NYTimes.
the class JacksonStringParserStoreTest method testCustomJsonFactoryStringParser.
@Test
public void testCustomJsonFactoryStringParser() {
JsonFactory jsonFactory = new JsonFactory();
Parser<String, Foo> parser = JacksonParserFactory.createStringParser(jsonFactory, Foo.class);
Store<Foo, BarCode> store = StoreBuilder.<BarCode, String, Foo>parsedWithKey().persister(persister).fetcher(fetcher).parser(parser).open();
Foo result = store.get(barCode).toBlocking().first();
validateFoo(result);
verify(fetcher, times(1)).fetch(barCode);
}
use of com.fasterxml.jackson.core.JsonFactory in project Store by NYTimes.
the class JacksonStringParserStoreTest method testNullTypeWithValidJsonFactory.
@Test
public void testNullTypeWithValidJsonFactory() {
expectedException.expect(NullPointerException.class);
JacksonParserFactory.createStringParser(new JsonFactory(), null);
}
Aggregations