Satz100 extends SatzX { public String getName(final int n) { switch (n) { case 1: return this.get(Feld100.NAME1).trim(); case 2: return this.get(Feld100.NAME2).trim(); case 3: return this.get(Feld100.NAME3).trim(); default: throw new IllegalArgumentException("1 <= n <= 3 expected, not n=" + n); } } Satz100(); void setName(final String vorname, final String nachname); void setName(final String vorname, final String mittelname, final String nachname); String getName(final int n);  }
@Test public void testGetName() throws IOException { satz.importFrom(INPUT); assertEquals("Pollsmann", satz.getName(1)); assertEquals("Rudolf", satz.getName(3)); }
@Test(expected = IllegalArgumentException.class) public void testGetNameIllegalArgument() { satz.getName(4); }