Skip to content

Commit 567b606

Browse files
committed
Fix server tests
1 parent c29a852 commit 567b606

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/java/com/faforever/client/remote/ServerAccessorTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import io.netty.handler.codec.string.LineEncoder;
6060
import io.netty.handler.codec.string.LineSeparator;
6161
import lombok.extern.slf4j.Slf4j;
62+
import okhttp3.mockwebserver.MockResponse;
6263
import okhttp3.mockwebserver.MockWebServer;
6364
import org.junit.jupiter.api.AfterEach;
6465
import org.junit.jupiter.api.BeforeEach;
@@ -156,14 +157,18 @@ public void setUp() throws Exception {
156157

157158
startFakeFafLobbyServer();
158159

159-
clientProperties.getServer()
160-
.setUrl("http://%s:%d".formatted(disposableServer.host(), disposableServer.port()));
160+
clientProperties.getUser()
161+
.setBaseUrl("http://localhost:%d".formatted(mockApi.getPort()));
161162
clientProperties.setUserAgent("downlords-faf-client");
162163

163164
WebClient webClient = WebClient.builder()
164165
.baseUrl(String.format("http://localhost:%s", mockApi.getPort()))
165166
.build();
166167

168+
mockApi.enqueue(new MockResponse()
169+
.setBody(objectMapper.writeValueAsString(new LobbyAccess("http://localhost:%d".formatted(disposableServer.port()))))
170+
.addHeader("Content-Type", "application/json;charset=utf-8"));
171+
167172
instance = new FafServerAccessor(notificationService, i18n, taskScheduler, tokenRetriever, uidService, eventBus, clientProperties, new FafLobbyClient(objectMapper), () -> webClient);
168173

169174
instance.afterPropertiesSet();

0 commit comments

Comments
 (0)