use of com.nytimes.android.external.store.util.NoKeyParser in project Store by NYTimes.
the class MultiParserTest method shouldParseChainProperly.
@Test
public void shouldParseChainProperly() {
List<KeyParser> parsersChain = new ArrayList<>();
parsersChain.add(new NoKeyParser<>(PARSER_1));
parsersChain.add(new NoKeyParser<>(PARSER_2));
parsersChain.add(new NoKeyParser<>(PARSER_3));
KeyParser<Object, Integer, UUID> parser = new MultiParser<>(parsersChain);
UUID parsed = parser.call(new Object(), 100);
assertNotNull(parsed);
}
use of com.nytimes.android.external.store.util.NoKeyParser in project Store by NYTimes.
the class MultiParserTest method shouldFailIfOneOfParsersIsInvalid.
@Test
public void shouldFailIfOneOfParsersIsInvalid() {
expectedException.expect(ParserException.class);
List<KeyParser> parsersChain = new ArrayList<>();
parsersChain.add(new NoKeyParser<>(PARSER_1));
parsersChain.add(new NoKeyParser<>(PARSER_3));
parsersChain.add(new NoKeyParser<>(PARSER_2));
KeyParser<Object, Integer, UUID> parser = new MultiParser<>(parsersChain);
UUID parsed = parser.call(new Object(), 100);
assertNotNull(parsed);
}
Aggregations