From 21f85fa4f58399a78e010301001aba0d101e5dcf Mon Sep 17 00:00:00 2001
From: Javed Ali <jali6@myune.edu.au>
Date: Sat, 9 Sep 2023 18:05:19 +1000
Subject: [PATCH] the unit tests for testing complete box by adding lines and
 for testing for the duplicate horizontal lines are added with failing reports

---
 .../dotsandboxes/DotsAndBoxesGridTest.java    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
index 1946bed..42c759c 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);
+        });
+    }
+
 }
-- 
GitLab