Datum extends Feld { public Date toDate() { try { return dateFormat.parse(this.getInhalt()); } catch (ParseException e) { throw new IllegalStateException(this + " has an invalid date (\"" + this.getInhalt() + "\")"); } } Datum(final Enum feldX);  Datum(final Enum feldX, final FeldInfo info);  Datum(final Bezeichner bezeichner, final int start);  Datum(final String name, final int start);  Datum(final String name, final String inhalt);  Datum(Bezeichner bezeichner, int length, int start);  Datum(final Bezeichner bezeichner, final FeldInfo info);  Datum(final String name, final int length, final int start, final String inhalt);  Datum();  Datum(final int start);  Datum(final int length, final int start);  Datum(final Datum other); void setInhalt(final Datum d); void setInhalt(final Date d); Date toDate(); static Datum heute(); @Override boolean isEmpty(); @Override boolean isValid(); @Override boolean isInvalid(); @Override List<ConstraintViolation> validate(); @Override String format(); @SuppressWarnings("squid:S2975") @Override Object clone();  }
@Test(expected = IllegalStateException.class) public void testToDate() { Datum silvester = new Datum("Silvester", "31122009"); LOG.info("Silvester is at " + silvester.toDate()); Datum invalid = new Datum("invalid", "xxxxxxxx"); LOG.info("invalid date: " + invalid.toDate()); }