From fb8331435e982c7dcae5d9315f30fc84c51525aa Mon Sep 17 00:00:00 2001
From: Muyuan Li <mli30@myune.edu.au>
Date: Sun, 24 Jul 2022 23:37:15 +0530
Subject: [PATCH] boxCompleteTest is the unit test to check whether a box at a
 particular coordinate is drawn from all sides. drawHorizontalTest checks
 whether there is an excetion thrown on redrawing the horizontal line.
 drawVerticalTest works similarly

---
 .../dotsandboxes/DotsAndBoxesGridTest.java    | 36 ++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
index 1946bed..bc54804 100644
--- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
@@ -27,5 +27,39 @@ public class DotsAndBoxesGridTest {
         assertTrue(true);
     }
 
-    // FIXME: You need to write tests for the two known bugs in the code.
+    @Test
+    public void boxCompleteTest() {
+        DotsAndBoxesGrid A = new DotsAndBoxesGrid(4,3,1);
+        A.drawHorizontal(0,0,1);
+        A.drawHorizontal(1,0,1);
+        A.drawVertical(0,0,1);
+        A.drawVertical(0,1,1);
+        asserTrue(A.boxComplete(0,0));
+    }
+
+    @Test
+    public void drawHorizontalTest(){
+        DotsAndBoxesGrid B = new DotsAndBoxesGrid(4,3,1);
+        B.drawHorizontal(0,0,1);
+        try{
+          B.drawHorizontal(0,0,1);
+        }
+        catch (Exception e){
+          assertEquals("Horizontal line already drawn", e.getMessage());
+        }
+
+    }
+
+    @Test
+    public void drawVerticalTest(){
+        DotsAndBoxesGrid C = new DotsAndBoxesGrid(4,3,1);
+        C.drawVertical(0,0,1);
+        try{
+          C.drawVertical(0,0,1);
+        }
+        catch (Exception e){
+          assertEquals("Vertical line already drawn", e.getMessage());
+        }
+
+    }    // FIXME: You need to write tests for the two known bugs in the code.
 }
-- 
GitLab