aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/fr/umlv
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/fr/umlv')
-rw-r--r--src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java b/src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java
new file mode 100644
index 0000000..7be657d
--- /dev/null
+++ b/src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java
@@ -0,0 +1,35 @@
1package fr.umlv.java.wallj.board;
2
3import org.junit.jupiter.api.Assertions;
4import org.junit.jupiter.api.Test;
5
6import java.io.IOException;
7import java.net.URISyntaxException;
8import java.nio.file.Path;
9import java.nio.file.Paths;
10
11/**
12 * @author Pacien TRAN-GIRARD
13 */
14final class BoardValidatorTest {
15
16 private Path getResourcePath(String str) throws URISyntaxException {
17 return Paths.get(getClass().getResource(str).toURI());
18 }
19
20 @Test
21 void testConstraints() throws URISyntaxException, IOException {
22 Board validBoard = BoardParser.parse(getResourcePath("/maps/bigValid.txt"));
23 Assertions.assertTrue(BoardValidator.Constraint.isBounded(validBoard));
24 Assertions.assertTrue(BoardValidator.Constraint.isHollow(validBoard));
25 Assertions.assertTrue(BoardValidator.Constraint.hasActualReachableBlocks(validBoard));
26 Assertions.assertTrue(BoardValidator.Constraint.hasMandatoryBlocks(validBoard));
27
28 Board invalidBoard = BoardParser.parse(getResourcePath("/maps/bigInvalid.txt"));
29 Assertions.assertFalse(BoardValidator.Constraint.isBounded(invalidBoard));
30 Assertions.assertFalse(BoardValidator.Constraint.isHollow(invalidBoard));
31 Assertions.assertFalse(BoardValidator.Constraint.hasActualReachableBlocks(invalidBoard));
32 Assertions.assertFalse(BoardValidator.Constraint.hasMandatoryBlocks(invalidBoard));
33 }
34
35}