Skip to content

Commit b1ca2e9

Browse files
committed
fix test
1 parent aa6bce2 commit b1ca2e9

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreRepositoryIT.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,4 @@ public void testShutdownFollowedByInit() {
4949
// ignore test
5050
}
5151

52-
@Disabled
53-
@Override
54-
public void getAllStatements() {
55-
// ignore test for now
56-
}
5752
}

testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/RepositoryTest.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
import static org.junit.jupiter.api.Assertions.assertEquals;
1414
import static org.junit.jupiter.api.Assertions.assertTrue;
1515

16+
import java.util.List;
17+
import java.util.Objects;
1618
import java.util.concurrent.TimeUnit;
19+
import java.util.stream.Collectors;
1720

1821
import org.eclipse.rdf4j.model.IRI;
1922
import org.eclipse.rdf4j.model.Literal;
@@ -114,6 +117,9 @@ public void setUp() throws Exception {
114117

115118
@AfterEach
116119
public void tearDown() {
120+
try (RepositoryConnection connection = testRepository.getConnection()) {
121+
connection.clear();
122+
}
117123
testRepository.shutDown();
118124
}
119125

@@ -164,19 +170,25 @@ public void getAllStatements() {
164170

165171
for (int i = 0; i < 1024 * 32; i++) {
166172
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(""));
168176
}
169177
}
170178

171179
for (int i = 0; i < 1024 * 32; i++) {
172180
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(""));
174184
}
175185
}
176186

177187
for (int i = 0; i < 1024 * 32; i++) {
178188
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(""));
180192
}
181193
}
182194
}

0 commit comments

Comments
 (0)