diff options
author | Pacien TRAN-GIRARD | 2016-03-01 18:41:39 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-03-01 18:41:39 +0100 |
commit | cc88afb9fe448b759966e94b07692fb6a154b2bf (patch) | |
tree | 0cf7fe569b6de16c4bd4dc8776fb82dfeeda312e /test/ch | |
parent | e80fc8044f9628c4d8d246eb764cb83a64f8d5dc (diff) | |
download | xblast-cc88afb9fe448b759966e94b07692fb6a154b2bf.tar.gz |
Disambiguate test assertions
Diffstat (limited to 'test/ch')
-rw-r--r-- | test/ch/epfl/xblast/server/BoardTest.java | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/test/ch/epfl/xblast/server/BoardTest.java b/test/ch/epfl/xblast/server/BoardTest.java index 014bd17..a7794d1 100644 --- a/test/ch/epfl/xblast/server/BoardTest.java +++ b/test/ch/epfl/xblast/server/BoardTest.java | |||
@@ -7,7 +7,7 @@ import org.junit.Test; | |||
7 | import java.util.ArrayList; | 7 | import java.util.ArrayList; |
8 | import java.util.List; | 8 | import java.util.List; |
9 | 9 | ||
10 | import static org.junit.Assert.assertTrue; | 10 | import static org.junit.Assert.*; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * @author Timothée FLOURE (257420) | 13 | * @author Timothée FLOURE (257420) |
@@ -48,22 +48,26 @@ public class BoardTest { | |||
48 | 48 | ||
49 | rowsList.add(sampleRow); | 49 | rowsList.add(sampleRow); |
50 | 50 | ||
51 | assertTrue(Board.ofRows(rowsList) instanceof Board); | 51 | Board.ofRows(rowsList); |
52 | } | 52 | } |
53 | 53 | ||
54 | @Test | 54 | @Test |
55 | public void buildBoardFromRowsMatrix() { | 55 | public void buildBoardFromRowsMatrix() { |
56 | List<List<Block>> rowsList = new ArrayList<>(); | 56 | try { |
57 | List<List<Block>> rowsList = new ArrayList<>(); | ||
57 | 58 | ||
58 | for (int i = 0; i < 13; i++) { | 59 | for (int i = 0; i < 13; i++) { |
59 | List<Block> sampleRow = new ArrayList<>(); | 60 | List<Block> sampleRow = new ArrayList<>(); |
60 | for (int j = 0; j < 15; j++) | 61 | for (int j = 0; j < 15; j++) |
61 | sampleRow.add(Block.FREE); | 62 | sampleRow.add(Block.FREE); |
62 | 63 | ||
63 | rowsList.add(sampleRow); | 64 | rowsList.add(sampleRow); |
64 | } | 65 | } |
65 | 66 | ||
66 | assertTrue(Board.ofRows(rowsList) instanceof Board); | 67 | assertNotNull(Board.ofRows(rowsList)); |
68 | } catch (Exception e) { | ||
69 | fail(e.getMessage()); | ||
70 | } | ||
67 | } | 71 | } |
68 | 72 | ||
69 | @Test(expected = IllegalArgumentException.class) | 73 | @Test(expected = IllegalArgumentException.class) |
@@ -82,22 +86,26 @@ public class BoardTest { | |||
82 | 86 | ||
83 | rowsList.add(sampleRow); | 87 | rowsList.add(sampleRow); |
84 | 88 | ||
85 | assertTrue(Board.ofInnerBlocksWalled(rowsList) instanceof Board); | 89 | Board.ofInnerBlocksWalled(rowsList); |
86 | } | 90 | } |
87 | 91 | ||
88 | @Test | 92 | @Test |
89 | public void buildBoardFromInnerBlocks() { | 93 | public void buildBoardFromInnerBlocks() { |
90 | List<List<Block>> rowsList = new ArrayList<>(); | 94 | try { |
95 | List<List<Block>> rowsList = new ArrayList<>(); | ||
91 | 96 | ||
92 | for (int i = 0; i < 11; i++) { | 97 | for (int i = 0; i < 11; i++) { |
93 | List<Block> sampleRow = new ArrayList<>(); | 98 | List<Block> sampleRow = new ArrayList<>(); |
94 | for (int j = 0; j < 13; j++) | 99 | for (int j = 0; j < 13; j++) |
95 | sampleRow.add(Block.FREE); | 100 | sampleRow.add(Block.FREE); |
96 | 101 | ||
97 | rowsList.add(sampleRow); | 102 | rowsList.add(sampleRow); |
98 | } | 103 | } |
99 | 104 | ||
100 | assertTrue(Board.ofInnerBlocksWalled(rowsList) instanceof Board); | 105 | assertNotNull(Board.ofInnerBlocksWalled(rowsList)); |
106 | } catch (Exception e) { | ||
107 | fail(e.getMessage()); | ||
108 | } | ||
101 | } | 109 | } |
102 | 110 | ||
103 | @Test(expected = IllegalArgumentException.class) | 111 | @Test(expected = IllegalArgumentException.class) |
@@ -116,22 +124,26 @@ public class BoardTest { | |||
116 | 124 | ||
117 | rowsList.add(sampleRow); | 125 | rowsList.add(sampleRow); |
118 | 126 | ||
119 | assertTrue(Board.ofQuadrantNWBlocksWalled(rowsList) instanceof Board); | 127 | Board.ofQuadrantNWBlocksWalled(rowsList); |
120 | } | 128 | } |
121 | 129 | ||
122 | @Test | 130 | @Test |
123 | public void buildBoardFromNWQuadrant() { | 131 | public void buildBoardFromNWQuadrant() { |
124 | List<List<Block>> rowsList = new ArrayList<>(); | 132 | try { |
133 | List<List<Block>> rowsList = new ArrayList<>(); | ||
125 | 134 | ||
126 | for (int i = 0; i < 6; i++) { | 135 | for (int i = 0; i < 6; i++) { |
127 | List<Block> sampleRow = new ArrayList<>(); | 136 | List<Block> sampleRow = new ArrayList<>(); |
128 | for (int j = 0; j < 7; j++) | 137 | for (int j = 0; j < 7; j++) |
129 | sampleRow.add(Block.FREE); | 138 | sampleRow.add(Block.FREE); |
130 | 139 | ||
131 | rowsList.add(sampleRow); | 140 | rowsList.add(sampleRow); |
132 | } | 141 | } |
133 | 142 | ||
134 | assertTrue(Board.ofQuadrantNWBlocksWalled(rowsList) instanceof Board); | 143 | assertNotNull(Board.ofQuadrantNWBlocksWalled(rowsList)); |
144 | } catch (Exception e) { | ||
145 | fail(e.getMessage()); | ||
146 | } | ||
135 | } | 147 | } |
136 | 148 | ||
137 | @Test | 149 | @Test |