Skip to content
Snippets Groups Projects
Commit 88ccee06 authored by skaur40's avatar skaur40
Browse files

Added Testcases

parent 2154a9b6
No related branches found
No related tags found
No related merge requests found
...@@ -28,4 +28,30 @@ public class DotsAndBoxesGridTest { ...@@ -28,4 +28,30 @@ public class DotsAndBoxesGridTest {
} }
// FIXME: You need to write tests for the two known bugs in the code. // FIXME: You need to write tests for the two known bugs in the code.
@Test
public void checkIfBoxComplete(){
DotsAndBoxesGrid dotsAndBoxesGrid = new DotsAndBoxesGrid(4, 3, 2);
dotsAndBoxesGrid.drawHorizontal(0, 0, 0);
dotsAndBoxesGrid.drawHorizontal(1, 0, 1);
dotsAndBoxesGrid.drawVertical(0, 0, 0);
assertFalse(dotsAndBoxesGrid.boxComplete(0, 0));
}
@Test
public void checkReDrawLine(){
DotsAndBoxesGrid dotsAndBoxesGrid = new DotsAndBoxesGrid(4, 3, 2);
dotsAndBoxesGrid.drawHorizontal(0, 0, 0);
Exception exception = assertThrows(IllegalStateException.class, () -> {
dotsAndBoxesGrid.drawHorizontal(0, 0, 1);
});
String expectedMessage = "Line already drawn";
String actualMessage = exception.getMessage();
assertTrue(actualMessage.contains(expectedMessage));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment