NumFeld extends Feld { @Override public List<ConstraintViolation> validate() { List<ConstraintViolation> violations = super.validate(); if (this.hasValue()) { try { this.toLong(); } catch (NumberFormatException nfe) { ConstraintViolation cv = new SimpleConstraintViolation(this, nfe); violations.add(cv); } } return violations; } NumFeld(final Enum feldX);  NumFeld(final Enum feldX, final FeldInfo info);  NumFeld(final String name, final String s);  NumFeld(Bezeichner bezeichner, int length, int start);  NumFeld(final Bezeichner bezeichner, final int length, final int start, final int value);  NumFeld(final String name, final int start, final String value);  NumFeld(final String name, final String s, final int nachkommastellen);  NumFeld(final Bezeichner name, final FeldInfo info); @Deprecated  NumFeld(final String name, final int start, final String value,
            final int nachkommastellen);  NumFeld(final Bezeichner name, final int start, final String value, final int nachkommastellen);  NumFeld(final Bezeichner name, final int length, final int start, final int value,
            final int nachkommastellen);  NumFeld(final NumFeld other); NumFeld mitNachkommastellen(final int n); int getNachkommastellen(); @Override void setInhalt(final int n); void setInhalt(final long n); @Override void resetInhalt(); int toInt(); long toLong(); double toDouble(); @Override boolean isValid(); @Override List<ConstraintViolation> validate(); @Override String format(); @SuppressWarnings("squid:S2975") @Override Object clone();  }
@Test public void testInvalidate() { NumFeld x = new NumFeld("x", "xxxx"); List<ConstraintViolation> violations = x.validate(); for (ConstraintViolation violation : violations) { LOG.info(violation.getValidatedObject() + ": " + violation.getMessage()); } assertEquals(1, violations.size()); }
@Test public void testValidate() { NumFeld three = new NumFeld("testValidate", "3 "); assertEquals(0, three.validate().size()); }