From 7098461874be4b08dfb9dcbc3288c30ab056e9af Mon Sep 17 00:00:00 2001 From: Chandana Maturi <cmaturi@myune.edu.au> Date: Wed, 28 Jul 2021 12:51:43 +0530 Subject: [PATCH] unit testing failed --- .../dotsandboxes/DotsAndBoxesGridTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 1aac7cc..d08f5cf 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"); + } } -- GitLab