diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 9a1ece826581895b90f250223c08f3c0f933d019..ef0170cc0a645a468f017dcda215aeec5085f90b 100644 --- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java +++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java @@ -38,4 +38,30 @@ public class DotsAndBoxesGridTest { grid.drawHorizontal(0, 0, 1); assertEquals(false, grid.boxComplete(0, 0)); } + + /** This test method tests if the drawHorizontal method in DotsAndBoxesGrid.java class returns an + * IllegalArgumentException error when the user tries to draw a horizontal line on top of another + * (on top of an existing line). */ + @DisplayName("Fails to throw an exception when attempting to draw a horizontal line on top of another") + @Test + public void testRedrawingTheLineHoriz() { + DotsAndBoxesGrid grid = new DotsAndBoxesGrid(4, 3, 2); + grid.drawHorizontal(1, 1, 1); + assertThrows(IllegalArgumentException.class, () -> { + grid.drawHorizontal(1, 1, 1); + }); + } + + /** This tests if the drawVertical method in DotsAndBoxesGrid.java class returns an + * IllegalArgumentException error when the user tries to draw a vertical line on top + * of another. */ + @DisplayName("Fails to throw an exception when attempting to draw a Vertical line on top of another") + @Test + public void testRedrawingTheLineVerti() { + DotsAndBoxesGrid grid = new DotsAndBoxesGrid(4, 3, 2); + grid.drawVertical(0, 1, 1); + assertThrows(IllegalArgumentException.class, () -> { + grid.drawVertical(0, 1, 1); + }); + } }