Skip to content

Commit 431c412

Browse files
committed
[grid] check session ownership once
1 parent 9f664c6 commit 431c412

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

java/test/org/openqa/selenium/grid/node/ForwardWebDriverCommandTest.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
package org.openqa.selenium.grid.node;
1919

20-
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
20+
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
2121
import static org.junit.jupiter.api.Assertions.assertEquals;
2222
import static org.mockito.Mockito.*;
2323
import static org.openqa.selenium.remote.http.Contents.asJson;
2424

25-
import com.google.common.collect.ImmutableMap;
25+
import java.util.Map;
2626
import java.util.UUID;
2727
import org.junit.jupiter.api.BeforeEach;
2828
import org.junit.jupiter.api.Test;
@@ -69,11 +69,18 @@ void testExecuteWithInvalidSessionOwner() {
6969
HttpResponse actualResponse = command.execute(mockRequest);
7070
HttpResponse expectResponse =
7171
new HttpResponse()
72-
.setStatus(HTTP_INTERNAL_ERROR)
72+
.setStatus(HTTP_NOT_FOUND)
7373
.setContent(
7474
asJson(
75-
ImmutableMap.of(
76-
"error", String.format("Session not found in node %s", mockNode.getId()))));
75+
Map.of(
76+
"value",
77+
Map.of(
78+
"error",
79+
"invalid session id",
80+
"message",
81+
"Cannot find session with id: " + sessionId,
82+
"stacktrace",
83+
""))));
7784
assertEquals(expectResponse.getStatus(), actualResponse.getStatus());
7885
assertEquals(expectResponse.getContentEncoding(), actualResponse.getContentEncoding());
7986
}

0 commit comments

Comments
 (0)