### Question:
DatableFromYearPropertyParser implements PropertyParser { @Override public Comparable<?> parseForSort(String value) { if (value == null) { return null; } Datable datable = deserializeDatable(value); return datable.isValid() ? datable.getFromYear() : null; }  @Override String parse(String value); @Override Comparable<?> parseForSort(String value);  }### Answer:
@Test public void parseForSortReturnsAnIntegerValueTheFromYearOfTheDatable() { String validDatableString = "\"2015-05-01\""; Object result = instance.parseForSort(validDatableString); assertThat(result, is(2015)); }
@Test public void parseForSortReturnsNullIfTheDatableIsNotValid() { String invalidDatableString = "hello world"; Object result = instance.parseForSort(invalidDatableString); assertThat(result, is(nullValue())); }