Solver { public Puzzle solvePuzzle() { Puzzle workingPuzzle = new Puzzle(originalPuzzle); solve(workingPuzzle); return workingPuzzle; } Solver(Puzzle puzzle); Puzzle solvePuzzle();  }
@Test public void ValidPuzzle_Solve_NoNullValues() { Puzzle solvedPuzzle = solvePuzzle(getPuzzle()); for (int x = 0; x < Puzzle.SIZE; x++) { for (int y = 0; y < Puzzle.SIZE; y++) { Point currentPoint = new Point(x, y); Assert.assertNotNull(solvedPuzzle.getNumber(currentPoint)); } } }
@Test public void ValidPuzzle_Solve_AllValuesInRange() { Puzzle solvedPuzzle = solvePuzzle(getPuzzle()); for (int x = 0; x < Puzzle.SIZE; x++) { for (int y = 0; y < Puzzle.SIZE; y++) { Point currentPoint = new Point(x, y); Integer value = solvedPuzzle.getNumber(currentPoint); Assert.assertTrue(isInRange(value)); } } }
@Test public void ValidPuzzle2_Solve_AllValuesInRange() { Puzzle solvedPuzzle = solvePuzzle(getPuzzle2()); for (int x = 0; x < Puzzle.SIZE; x++) { for (int y = 0; y < Puzzle.SIZE; y++) { Point currentPoint = new Point(x, y); Integer value = solvedPuzzle.getNumber(currentPoint); Assert.assertTrue(isInRange(value)); } } }
@Test public void ValidPuzzle_Solve_NoDuplicateValuesInColumns() { Puzzle solvedPuzzle = solvePuzzle(getPuzzle()); for (int x = 0; x < 9; x++) { List<Point> colPoints = new ArrayList<>(); for (int y = 0; y < Puzzle.SIZE; y++) { colPoints.add(new Point(x, y)); } AssertNoDuplicatesInLine(solvedPuzzle, colPoints); } }
@Test public void ValidPuzzle_Solve_NoDuplicateValuesInRows() { Puzzle solvedPuzzle = solvePuzzle(getPuzzle()); for (int y = 0; y < 9; y++) { List<Point> colPoints = new ArrayList<>(); for (int x = 0; x < Puzzle.SIZE; x++) { colPoints.add(new Point(x, y)); } AssertNoDuplicatesInLine(solvedPuzzle, colPoints); } }