### Question:
LevelSolver { Level solve(Level level, int maxDepth) { List<Level> possibleSolutions = new ArrayList<>(); Level levelToSolve = new Level(level); levelToSolve.setMinimumMovesToSolve(maxDepth + 1); highestHit = maxDepth + 1; Tile[][] field = level.getField(); columns = field.length; rows = field[0].length; solve(levelToSolve, maxDepth, 0, possibleSolutions); Level best = new Level(); best.setMinimumMovesToSolve(maxDepth + 1); for (Level possibleSolution : possibleSolutions) { if (possibleSolution.getMinimumMovesToSolve() < best.getMinimumMovesToSolve()) { best = possibleSolution; } } if (best.getMinimumMovesToSolve() == maxDepth + 1) { return null; } return best; } LevelSolver(GameFieldService gameFieldService);   }### Answer:
@Test public void solveOneMoveColumnTrue() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_ONE_MOVE_COLUMN), 4); assertThat(solvedLevel, notNullValue()); assertThat(solvedLevel.getMinimumMovesToSolve(), is(1)); }
@Test public void solveTwoMoveColumnFalse() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_TWO_MOVE_COLUMN), 4); assertThat(solvedLevel, notNullValue()); assertThat(solvedLevel.getMinimumMovesToSolve(), is(2)); }
@Test public void solveOneMoveRowTrue() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_ONE_MOVE_ROW), 4); assertThat(solvedLevel, notNullValue()); assertThat(solvedLevel.getMinimumMovesToSolve(), is(1)); }
@Test public void solveTwoMoves() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_TWO_MOVES), 4); assertThat(solvedLevel, notNullValue()); assertThat(solvedLevel.getMinimumMovesToSolve(), is(2)); }
@Test public void solveThreeMoves() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_THREE_MOVES), 4); assertThat(solvedLevel, notNullValue()); assertThat(solvedLevel.getMinimumMovesToSolve(), is(3)); }
@Test public void solveFourMovesNotEnoughDeepth() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_FOUR_MOVES), 3); assertThat(solvedLevel, nullValue()); }
@Test public void solveFourMoves() { Level solvedLevel = sut.solve(levelTranslator.fromString(LEVEL_FOUR_MOVES), 4); assertThat(solvedLevel, notNullValue()); assertThat(solvedLevel.getMinimumMovesToSolve(), is(4)); }