### Question:
TimestampDataConverter implements DataConverter<Timestamp>, DateParser<Timestamp> { @Override public Timestamp stringToValue(String rawData) throws ParseException { try{ return StringUtils.isNotEmpty(rawData) ? new Timestamp(getDateTimeFormatter().parse(rawData).getTime()) : null; } catch (ParseException e){ try { return Timestamp.valueOf(rawData); } catch (IllegalArgumentException ex){ throw e; } } }  @Override Timestamp stringToValue(String rawData); @Override String valueToString(Timestamp value); @Override Timestamp parsDate(String rawData); @Override String dateToString(Timestamp value); static DateFormat getDateFormatWithTimeZone(DateFormat dateFormat);  }### Answer:
@Test public void stringToValue_rawDataIsEmptyString_returnNull() throws ParseException { assertNull(timestampDataConverter.stringToValue("")); }
@Test public void stringToValue_rawDataIsNull_returnNull() throws ParseException { assertNull(timestampDataConverter.stringToValue(null)); }
@Test(expected = ParseException.class) public void stringToValue_valueIsNotAcceptable_ExceptionThrown() throws ParseException { assertNull(timestampDataConverter.stringToValue("test")); }
@Test public void stringToValue_rawDataIsTimestampString_returnTimestamp() throws ParseException { assertEquals(timestampDataConverter.stringToValue("2018-05-11 11:00:00"), Timestamp.valueOf("2018-05-11 11:00:00")); }
@Test public void stringToValue_rawDataIsTimestampStringWithTSeparator_returnTimestamp() throws ParseException { assertEquals(timestampDataConverter.stringToValue("2018-05-11T11:00:00"), Timestamp.valueOf("2018-05-11 11:00:00")); }
@Test public void stringToValue_rawDataIsTimeStringAndIsApplyClientTimezoneIsFalse_returnTime() throws ParseException { when(clientTimezoneFormattingRulesResolver.isApplyClientTimezone(any(Class.class))).thenReturn(false); assertEquals(timestampDataConverter.stringToValue("2018-05-11 11:00:00"), Timestamp.valueOf("2018-05-11 11:00:00")); }