@Test public void parseReturnsNullIfTheInputCannotBeParsed() throws JsonProcessingException { String value = instance.parse("invalid serialized names"); assertThat(value, is(nullValue())); }
@Override public String parse(String value) { if (value != null) { try { PersonNames personNames = readPersonNames(value); return personNames.defaultName().getFullName(); } catch (IOException e) { LOG.error("Cannot parse '{}' as PersonNames", value); LOG.error("Exception thrown", e); } } return null; }
PersonNamesDefaultNamePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { PersonNames personNames = readPersonNames(value); return personNames.defaultName().getFullName(); } catch (IOException e) { LOG.error("Cannot parse '{}' as PersonNames", value); LOG.error("Exception thrown", e); } } return null; } }
PersonNamesDefaultNamePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { PersonNames personNames = readPersonNames(value); return personNames.defaultName().getFullName(); } catch (IOException e) { LOG.error("Cannot parse '{}' as PersonNames", value); LOG.error("Exception thrown", e); } } return null; }  }
PersonNamesDefaultNamePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { PersonNames personNames = readPersonNames(value); return personNames.defaultName().getFullName(); } catch (IOException e) { LOG.error("Cannot parse '{}' as PersonNames", value); LOG.error("Exception thrown", e); } } return null; }  @Override String parse(String value); @Override Comparable<?> parseForSort(String value); }
PersonNamesDefaultNamePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { PersonNames personNames = readPersonNames(value); return personNames.defaultName().getFullName(); } catch (IOException e) { LOG.error("Cannot parse '{}' as PersonNames", value); LOG.error("Exception thrown", e); } } return null; }  @Override String parse(String value); @Override Comparable<?> parseForSort(String value);  }