### Question:
LevelTranslator { public Level fromString(String[] string) { Tile[][] field; Level level = new Level(); int indexOfProperties = 0; for (; string[indexOfProperties].charAt(0) != '#'; indexOfProperties++) { switch (indexOfProperties) { case 0: level.setId(Integer.parseInt(string[0])); break; case 1: level.setMinimumMovesToSolve(Integer.parseInt(string[1])); break; case 2: level.setTilesCount(Integer.parseInt(string[2])); default: break; } } ArrayList<String> stringsForField = new ArrayList<>(); for (int i = indexOfProperties + 1; i < string.length; i++) { stringsForField.add(i - indexOfProperties - 1, string[i]); } field = getTiles(stringsForField.toArray(new String[stringsForField.size()]), level); level.setField(field); return level; }  Level fromString(String[] string);  }### Answer:
@Test public void fromString() { Level resultingLevel = sut.fromString(levelAsString); assertThat(resultingLevel, is(level)); }
@Test(expected = IllegalArgumentException.class) public void fromStringInvalid() { sut.fromString(invalidLevelAsString); }