|
18 | 18 | */
|
19 | 19 | package org.neo4j.driver.internal;
|
20 | 20 |
|
| 21 | +import static java.util.concurrent.CompletableFuture.completedFuture; |
21 | 22 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
22 | 23 | import static org.mockito.ArgumentMatchers.any;
|
23 | 24 | import static org.mockito.BDDMockito.given;
|
|
28 | 29 | import java.util.List;
|
29 | 30 | import java.util.function.Consumer;
|
30 | 31 | import org.junit.jupiter.api.BeforeEach;
|
| 32 | +import org.junit.jupiter.api.Test; |
31 | 33 | import org.junit.jupiter.params.ParameterizedTest;
|
32 | 34 | import org.junit.jupiter.params.provider.MethodSource;
|
33 | 35 | import org.neo4j.driver.Session;
|
34 | 36 | import org.neo4j.driver.TransactionCallback;
|
35 | 37 | import org.neo4j.driver.TransactionConfig;
|
36 | 38 | import org.neo4j.driver.TransactionContext;
|
37 | 39 | import org.neo4j.driver.internal.async.NetworkSession;
|
| 40 | +import org.neo4j.driver.internal.async.UnmanagedTransaction; |
38 | 41 | import org.neo4j.driver.internal.retry.RetryLogic;
|
39 | 42 |
|
40 | 43 | public class InternalSessionTest {
|
@@ -84,6 +87,19 @@ void shouldDelegateExecuteReadToRetryLogic(ExecuteVariation executeVariation) {
|
84 | 87 | then(logic).should().retry(any());
|
85 | 88 | }
|
86 | 89 |
|
| 90 | + @Test |
| 91 | + void shouldDelegateBeginWithType() { |
| 92 | + var internalSession = (InternalSession) session; |
| 93 | + var config = TransactionConfig.empty(); |
| 94 | + var type = "TYPE"; |
| 95 | + given(networkSession.beginTransactionAsync(config, type)) |
| 96 | + .willReturn(completedFuture(mock(UnmanagedTransaction.class))); |
| 97 | + |
| 98 | + internalSession.beginTransaction(config, type); |
| 99 | + |
| 100 | + then(networkSession).should().beginTransactionAsync(config, type); |
| 101 | + } |
| 102 | + |
87 | 103 | static List<ExecuteVariation> executeVariations() {
|
88 | 104 | return Arrays.asList(
|
89 | 105 | new ExecuteVariation(false, false, false),
|
|
0 commit comments