|
13 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals; |
14 | 14 | import static org.junit.jupiter.api.Assertions.assertTrue; |
15 | 15 |
|
| 16 | +import java.util.List; |
| 17 | +import java.util.Objects; |
16 | 18 | import java.util.concurrent.TimeUnit; |
| 19 | +import java.util.stream.Collectors; |
17 | 20 |
|
18 | 21 | import org.eclipse.rdf4j.model.IRI; |
19 | 22 | import org.eclipse.rdf4j.model.Literal; |
@@ -114,6 +117,9 @@ public void setUp() throws Exception { |
114 | 117 |
|
115 | 118 | @AfterEach |
116 | 119 | public void tearDown() { |
| 120 | + try (RepositoryConnection connection = testRepository.getConnection()) { |
| 121 | + connection.clear(); |
| 122 | + } |
117 | 123 | testRepository.shutDown(); |
118 | 124 | } |
119 | 125 |
|
@@ -164,19 +170,25 @@ public void getAllStatements() { |
164 | 170 |
|
165 | 171 | for (int i = 0; i < 1024 * 32; i++) { |
166 | 172 | try (RepositoryResult<Statement> statements = conn.getStatements(null, null, null)) { |
167 | | - assertEquals(2, statements.stream().count()); |
| 173 | + List<Statement> collect = statements.stream().collect(Collectors.toList()); |
| 174 | + assertEquals(2, collect.size(), "Iteration " + i + " failed with data:\n" |
| 175 | + + collect.stream().map(Objects::toString).reduce((a, b) -> a + "\n" + b).orElse("")); |
168 | 176 | } |
169 | 177 | } |
170 | 178 |
|
171 | 179 | for (int i = 0; i < 1024 * 32; i++) { |
172 | 180 | try (RepositoryResult<Statement> statements = conn.getStatements(null, RDF.TYPE, null)) { |
173 | | - assertEquals(1, statements.stream().count()); |
| 181 | + List<Statement> collect = statements.stream().collect(Collectors.toList()); |
| 182 | + assertEquals(1, collect.size(), "Iteration " + i + " failed with data:\n" |
| 183 | + + collect.stream().map(Objects::toString).reduce((a, b) -> a + "\n" + b).orElse("")); |
174 | 184 | } |
175 | 185 | } |
176 | 186 |
|
177 | 187 | for (int i = 0; i < 1024 * 32; i++) { |
178 | 188 | try (RepositoryResult<Statement> statements = conn.getStatements(null, null, null)) { |
179 | | - assertEquals(2, statements.stream().count()); |
| 189 | + List<Statement> collect = statements.stream().collect(Collectors.toList()); |
| 190 | + assertEquals(2, collect.size(), "Iteration " + i + " failed with data:\n" |
| 191 | + + collect.stream().map(Objects::toString).reduce((a, b) -> a + "\n" + b).orElse("")); |
180 | 192 | } |
181 | 193 | } |
182 | 194 | } |
|
0 commit comments