@Test public void parseReturnsNullIfTheInputCannotBeParsed() { String output = instance.parse("notASerializedChange"); assertThat(output, is(nullValue())); }
@Override public String parse(String value) { if (value != null) { try { long timeStamp = readTimeStamp(value); Date date = new Date(timeStamp); return new SimpleDateFormat("yyyyMMdd").format(date); } catch (IOException e) { LOG.error("Cannot parse '{}' as Change", value); LOG.error("Exception thrown", e); } } return null; }
ChangeDatePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { long timeStamp = readTimeStamp(value); Date date = new Date(timeStamp); return new SimpleDateFormat("yyyyMMdd").format(date); } catch (IOException e) { LOG.error("Cannot parse '{}' as Change", value); LOG.error("Exception thrown", e); } } return null; } }
ChangeDatePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { long timeStamp = readTimeStamp(value); Date date = new Date(timeStamp); return new SimpleDateFormat("yyyyMMdd").format(date); } catch (IOException e) { LOG.error("Cannot parse '{}' as Change", value); LOG.error("Exception thrown", e); } } return null; } ChangeDatePropertyParser(); }
ChangeDatePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { long timeStamp = readTimeStamp(value); Date date = new Date(timeStamp); return new SimpleDateFormat("yyyyMMdd").format(date); } catch (IOException e) { LOG.error("Cannot parse '{}' as Change", value); LOG.error("Exception thrown", e); } } return null; } ChangeDatePropertyParser(); @Override String parse(String value); @Override Comparable<?> parseForSort(String value); }
ChangeDatePropertyParser implements PropertyParser { @Override public String parse(String value) { if (value != null) { try { long timeStamp = readTimeStamp(value); Date date = new Date(timeStamp); return new SimpleDateFormat("yyyyMMdd").format(date); } catch (IOException e) { LOG.error("Cannot parse '{}' as Change", value); LOG.error("Exception thrown", e); } } return null; } ChangeDatePropertyParser(); @Override String parse(String value); @Override Comparable<?> parseForSort(String value); static final Logger LOG; }