Skip to content

Commit bf5f5f1

Browse files
Marc-SpectorSheikah45
authored andcommitted
fix a captor in mockStartGameProcess method
1 parent ab825cd commit bf5f5f1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/test/java/com/faforever/client/game/GameRunnerTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import java.util.Set;
6666
import java.util.concurrent.CompletableFuture;
6767
import java.util.concurrent.ExecutorService;
68+
import java.util.function.Supplier;
6869

6970
import static java.util.concurrent.CompletableFuture.completedFuture;
7071
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -150,7 +151,7 @@ public class GameRunnerTest extends ServiceTest {
150151
@Spy
151152
private NotificationPrefs notificationPrefs;
152153
@Captor
153-
private ArgumentCaptor<SimpleTask<?>> simpleTaskCaptor;
154+
private ArgumentCaptor<Supplier<CompletableFuture<Object>>> simpleTaskCaptor;
154155

155156
@Mock
156157
private EnterPasswordController enterPasswordController;
@@ -201,9 +202,9 @@ private void mockStartGameProcess(GameLaunchResponse gameLaunchResponse) throws
201202
lenient().when(iceAdapter.start(anyInt(), anyBoolean())).thenReturn(completedFuture(GPG_PORT));
202203
lenient().when(coturnService.getIceSession(anyInt()))
203204
.thenReturn(Mono.just(new IceSession("someSessionId", false, List.of())));
204-
lenient().when(taskService.submitTask(simpleTaskCaptor.capture())).thenAnswer(_ -> {
205-
SimpleTask<?> task = simpleTaskCaptor.getValue();
206-
task.getFuture().join();
205+
lenient().when(taskService.submitFutureTask(anyString(), simpleTaskCaptor.capture())).thenAnswer(_ -> {
206+
CompletableFuture<Object> task = simpleTaskCaptor.getValue().get();
207+
task.join();
207208
return task;
208209
});
209210
lenient().when(process.onExit()).thenReturn(new CompletableFuture<>());

0 commit comments

Comments
 (0)