TakatoekalandNamer implements Namer { @Override public void parseName(String name) throws InvalidNameException { if (name.length() == 0 || name.indexOf(" ") == -1) throw new InvalidNameException(); firstName = name.substring(name.indexOf(" ") + 1, name.length()); lastName = name.substring(0, name.indexOf(" ")); }  @Override void parseName(String name); @Override String getFirstName(); @Override String getLastName();  }
@Test(expected = InvalidNameException.class) public void emptyStringLeadsToInvalidNameException() throws InvalidNameException { namer.parseName(""); }
@Test(expected = InvalidNameException.class) public void stringWithoutSpacesLeadsToInvalidNameException() throws InvalidNameException { namer.parseName("Middelkoop"); }