diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 1946beda974d180686c65c0259a7b881e9a4eb5a..be39b0f0da712cfdc395b52152bd637533ebf73c 100644 --- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java +++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java @@ -27,5 +27,36 @@ public class DotsAndBoxesGridTest { assertTrue(true); } - // FIXME: You need to write tests for the two known bugs in the code. + @Test + public void testBoxComplete() { + logger.info("Test to show that box complete runs correctly"); + DotsAndBoxesGrid DaB = new DotsAndBoxesGrid(10, 10, 1); + Assertions.assertEquals(false, DaB.boxComplete(4, 3)); + } + + @Test + public void testdrawHorizontal() { + logger.info("Test to show horizontal lines can only be draw once in the same place"); + DotsAndBoxesGrid DaB = new DotsAndBoxesGrid(10, 10, 1); + DaB.drawHorizontal(4, 2, 1); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaB.drawHorizontal(4,2, 1); + }, "There is already a horizontal line here. "); + + } + + @Test + public void testdrawVertical() { + logger.info("Test to show vertical lines can only be draw once in the same place"); + DotsAndBoxesGrid DaB = new DotsAndBoxesGrid(10, 10, 1); + DaB.drawVertical(4, 2, 1); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaB.drawVertical(4,2, 1); + }, "There is already a vertical line here. "); + } + } + + +// FIXME: You need to write tests for the two known bugs in the code. +