Skip to content
Snippets Groups Projects
Commit bc6c17ab authored by Krishkumar Sandipkumar Patel's avatar Krishkumar Sandipkumar Patel
Browse files

Added two more test methods that tests if drawing a horizontal line or...

Added two more test methods that tests if drawing a horizontal line or vertical line on top of another would throw an IllegalArgumentException error. Both test methods failed.
parent c369e303
No related branches found
No related tags found
No related merge requests found
......@@ -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);
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment