### Question:
HBaseIndexingOptions { static Long evaluateTimestamp(String timestampString, String timestampFormat) { if (timestampString == null) { return null; } if (timestampFormat == null) { try { return Long.parseLong(timestampString); } catch (NumberFormatException e) { throw new IllegalStateException("Invalid timestamp value: " + timestampString); } } else { SimpleDateFormat dateTimeFormat = null; try { dateTimeFormat = new SimpleDateFormat(timestampFormat); } catch (IllegalArgumentException e) { throw new IllegalStateException("Invalid timestamp format: " + e.getMessage()); } try { return dateTimeFormat.parse(timestampString).getTime(); } catch (ParseException e) { throw new IllegalStateException("Can't parse timestamp string '" + timestampString + "': " + e.getMessage()); } } } HBaseIndexingOptions(Configuration conf); boolean isDirectWrite(); List<Scan> getScans(); IndexingSpecification getIndexingSpecification(); void evaluate(); boolean isGeneratedOutputDir();  }### Answer:
@Test public void testEvaluateTimestamp_NoFormatSupplied() { assertEquals( Long.valueOf(12345), HBaseIndexingOptions.evaluateTimestamp("12345", null)); }
@Test(expected=IllegalStateException.class) public void testEvaluateTimestamp_NoFormat_NonParseableLong() { HBaseIndexingOptions.evaluateTimestamp("abc", null); }
@Test public void testEvaluateTimestamp_CustomTimestampFormat() { assertEquals( Long.valueOf(DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").parseMillis("2013/10/20 00:39:00")), HBaseIndexingOptions.evaluateTimestamp("2013/10/20 00:39:00", "yyyy/MM/dd HH:mm:ss")); }
@Test(expected=IllegalStateException.class) public void testEvaluateTimestamp_InvalidTimestampFormat() { HBaseIndexingOptions.evaluateTimestamp("2013/10/20 00:39", "not a timestamp format"); }
@Test(expected=IllegalStateException.class) public void testEvaluateTimestamp_TimestampNotAccordingToFormat() { HBaseIndexingOptions.evaluateTimestamp("invalid timestamp data", "yyyy/MM/dd HH:mm"); }
@Test public void testEvaluateTimestamp_NullTimestamp() { assertNull(HBaseIndexingOptions.evaluateTimestamp(null, null)); }