diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 1aac7ccc87bd5620cdcd1db9b008f20a08d50640..d08f5cf08340171ab50aee96e4f2ef997a6e9624 100644 --- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java +++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java @@ -28,4 +28,31 @@ public class DotsAndBoxesGridTest { } // FIXME: You need to write tests for the two known bugs in the code. + @Test + public void checkforBoxComplete() { + logger.info("Check wheather the box is complete is wrong or not"); + int x = 1; + int y = 1; + int p = 1; + DotsAndBoxesGrid z = new DotsAndBoxesGrid(x, y, p); + + assertFalse(z.boxComplete(x, y)); + + } + + @Test + public void testExistingLine() { + logger.info("testing exception is thrown when line exists"); + int x = 2; + int y = 3; + int p = 2; + int w = 12; + int h = 3; + + DotsAndBoxesGrid z = new DotsAndBoxesGrid(w, h, p); + + z.drawHorizontal(x, y, p); + + assertThrows(IllegalStateException.class, () -> z.drawHorizontal(x, y, p), "The line exists"); + } }