Skip to content

Commit

Permalink
+ more test
Browse files Browse the repository at this point in the history
  • Loading branch information
q3769 committed Dec 19, 2024
1 parent b556424 commit 8253165
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,11 @@
<version>33.2.0-jre</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.14.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
26 changes: 26 additions & 0 deletions src/test/java/conseq4j/execute/SequentialExecutorTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package conseq4j.execute;

import static org.awaitility.Awaitility.await;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.spy;

import java.util.concurrent.*;

class SequentialExecutorTest {
@org.junit.jupiter.api.Test
void executeShouldDelegateToSubmit() {
SequentialExecutor sequentialExecutor = spy(new SequentialExecutor() {
@Override
public <T> Future<T> submit(Callable<T> task, Object sequenceKey) {
return CompletableFuture.completedFuture(null);
}
});

Future<Void> execute = sequentialExecutor.execute(() -> {}, "testKey");
await().until(execute::isDone);

then(sequentialExecutor).should().submit(any(Callable.class), eq("testKey"));
}
}

0 comments on commit 8253165

Please sign in to comment.