Skip to content

Commit d14087b

Browse files
authored
Merge branch 'trunk' into bidi_add_authentication_handler
2 parents 63c4449 + 97c5118 commit d14087b

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2424
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2525
import static org.assertj.core.api.InstanceOfAssertFactories.MAP;
26-
import static org.junit.jupiter.api.Assertions.assertThrows;
27-
import static org.junit.jupiter.api.Assertions.assertTrue;
2826
import static org.openqa.selenium.json.Json.MAP_TYPE;
2927
import static org.openqa.selenium.remote.http.Contents.string;
3028
import static org.openqa.selenium.remote.http.HttpMethod.DELETE;
@@ -402,20 +400,14 @@ void shouldOnlyRespondToWebDriverCommandsForSessionsTheNodeOwns() {
402400
assertThat(node2.matches(req2)).isTrue();
403401

404402
// Assert that should not respond to commands for sessions Node 1 does not own
405-
NoSuchSessionException exception =
406-
assertThrows(NoSuchSessionException.class, () -> node.execute(req2));
407-
assertTrue(
408-
exception
409-
.getMessage()
410-
.startsWith(String.format("Cannot find session with id: %s", session2.getId())));
403+
HttpResponse res1 = node.execute(req2);
404+
assertThat(res1.getStatus()).isEqualTo(404);
405+
assertThat(Contents.string(res1)).contains("invalid session id");
411406

412407
// Assert that should not respond to commands for sessions Node 2 does not own
413-
NoSuchSessionException exception2 =
414-
assertThrows(NoSuchSessionException.class, () -> node2.execute(req));
415-
assertTrue(
416-
exception2
417-
.getMessage()
418-
.startsWith(String.format("Cannot find session with id: %s", session.getId())));
408+
HttpResponse res2 = node2.execute(req);
409+
assertThat(res2.getStatus()).isEqualTo(404);
410+
assertThat(Contents.string(res2)).contains("invalid session id");
419411
}
420412

421413
@Test

0 commit comments

Comments
 (0)