Skip to content

Commit 8cfdb2c

Browse files
committed
initial commit
1 parent 9c8344a commit 8cfdb2c

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 Eclipse RDF4J contributors.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Distribution License v1.0
6+
* which accompanies this distribution, and is available at
7+
* http://www.eclipse.org/org/documents/edl-v10.php.
8+
*
9+
* SPDX-License-Identifier: BSD-3-Clause
10+
*******************************************************************************/
11+
// Some portions generated by Codex
12+
package org.eclipse.rdf4j.common.iteration;
13+
14+
import static org.junit.jupiter.api.Assertions.assertEquals;
15+
import static org.junit.jupiter.api.Assertions.assertThrows;
16+
import static org.junit.jupiter.api.Assertions.assertTrue;
17+
18+
import java.util.List;
19+
20+
import org.eclipse.rdf4j.http.client.QueryExecutionContext;
21+
import org.junit.jupiter.api.AfterEach;
22+
import org.junit.jupiter.api.Test;
23+
24+
class DistinctIterationTest {
25+
26+
@AfterEach
27+
void tearDown() {
28+
QueryExecutionContext.reset();
29+
}
30+
31+
@Test
32+
void shouldConsultQueryExecutionContextWhenFilteringDistinctValues() {
33+
QueryExecutionContext.failOnCheckpoint(new RuntimeException("breaker checkpoint"));
34+
35+
DistinctIteration<Integer> iteration = new DistinctIteration<>(
36+
new CloseableIteratorIteration<>(List.of(1, 2, 3).iterator()), java.util.HashSet::new);
37+
38+
RuntimeException exception = assertThrows(RuntimeException.class, iteration::hasNext);
39+
assertEquals("breaker checkpoint", exception.getMessage());
40+
assertTrue(QueryExecutionContext.getMarkHeavyCalls() > 0);
41+
assertTrue(QueryExecutionContext.getCheckpointCalls() > 0);
42+
}
43+
}

0 commit comments

Comments
 (0)