Feld implements Comparable<Feld>, Cloneable { public boolean isValid() { if (this.getByteAdresse() < 1) { return false; } if (this.getEndAdresse() > 256) { return false; } if (this.ausrichtung == Align.UNKNOWN) { return false; } return this.validate().isEmpty(); } Feld();  Feld(final Enum feldX);  Feld(final Enum feldX, final FeldInfo info);  Feld(final String name, final String s, final Align alignment);  Feld(final Bezeichner name, final int start, final String s, final Align alignment);  Feld(final Bezeichner bezeichner, final int length, final int start, final Align alignment);  Feld(final String name, final int length, final int start, final char c, final Align alignment);  Feld(final String name, final int length, final int start, final String s, final Align alignment);  Feld(final String name, final int start, final char c);  Feld(final int start, final String s, final Align alignment);  Feld(final int length, final Align alignment);  Feld(final int length, final int start, final Align alignment);  Feld(final Feld other); static Feld createFeld(final Enum feldX, final FeldInfo info); String getBezeichnung(); Bezeichner getBezeichner(); final void setInhalt(final String s); void setInhalt(final int n); void setInhalt(final char c); void setInhalt(final char c, final int i); String getInhalt(); void resetInhalt(); void setAnzahlBytes(final int n); final int getAnzahlBytes(); final int getByteAdresse(); final int getEndAdresse(); final boolean overlapsWith(final Feld other); final void write(final Writer writer); boolean isEmpty(); boolean hasValue(); boolean isValid(); boolean isInvalid(); List<ConstraintViolation> validate(); String format(); @Override String toString(); @Override final boolean equals(final Object obj); @Override final int hashCode(); @Override final int compareTo(final Feld other); static Bezeichner getAsBezeichner(final Enum feldX); static String getAsBezeichnung(final Enum feldX); static String toBezeichnung(final Enum name); @SuppressWarnings("squid:S2975") @Override Object clone(); static final Feld NULL_FELD; }
@Test public void testIsValid() { Feld a = new Feld(new Bezeichner("a"), 257, -1, Align.UNKNOWN); assertFalse(a + " is not valid - to long, wrong start byte, unknow alignment", a.isValid()); Feld b = new Feld(new Bezeichner("b"), 2, 256, Align.LEFT); assertFalse(b + " geht ueber Satz-Grenze hinweg", b.isValid()); Feld c = new Feld("c", 1, 'c'); assertTrue(c + " should be valid", c.isValid()); }