### Question:
ParseDate implements IsParser<Date> { @Override public Date parse(Object o, Field field) { if (!isValid(o)) { return null; } JsonFormat formatAnn = field.getAnnotation(JsonFormat.class); if (formatAnn == null) { throw new RuntimeException("JsonFormat with pattern needed for: " + field.getName()); } try { return new SimpleDateFormat(formatAnn.pattern(), Locale.getDefault()).parse(o.toString()); } catch (ParseException e) { throw new RuntimeException("JsonFormat with pattern is wrong for: " + field.getName() + " pattern: " + formatAnn.pattern()); } }  @Override Date parse(Object o, Field field); @Override void setCell(Date o, Cell cell, Field field);  }### Answer:
@Test public void parse() throws Exception { Date actual = parseDate.parse(null, null); assertEquals(null, actual); actual = parseDate.parse(expected, this.getClass().getDeclaredField("jsonFormatField")); assertEquals(new SimpleDateFormat("dd.MM.yyyy").parse(expected), actual); }
@Test(expected = RuntimeException.class) public void parseWithoutJsonFormat() throws Exception { parseDate.parse(expected, this.getClass().getDeclaredField("noneJsonFormatField")); fail("Should throw RuntimeException"); }
@Test(expected = RuntimeException.class) public void parseWithWrongJsonFormat() throws Exception { parseDate.parse(expected, this.getClass().getDeclaredField("wrongFormatField")); fail("Should throw RuntimeException"); }