diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 1946beda974d180686c65c0259a7b881e9a4eb5a..42c759cc77e3e9fc601ed838e5ed3add140ba3dc 100644 --- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java +++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java @@ -28,4 +28,26 @@ public class DotsAndBoxesGridTest { } // FIXME: You need to write tests for the two known bugs in the code. + + /* Test a grid with lines forming a complete box */ + @Test + public void testIfBoxComplete() { + logger.info("test a grid with lines forming a complete box"); + DotsAndBoxesGrid grid = new DotsAndBoxesGrid(4, 3, 1); + assertFalse(grid.boxComplete(0, 0)); + + } + + /* Test if drawing a duplicate line throws IllegalStateException */ + @Test + public void testDrawDuplicateLine() { + logger.info("Test if drawing a duplicate line throws IllegalStateException"); + DotsAndBoxesGrid grid = new DotsAndBoxesGrid(5, 3, 2); + grid.drawHorizontal(1, 1, 1); + + assertThrows(IllegalStateException.class, () -> { + grid.drawHorizontal(1, 1, 1); + }); + } + }