From 28591b1a7f4395f5222098bf2eb01cfa02e9cf95 Mon Sep 17 00:00:00 2001 From: Dmitriy Dubson Date: Wed, 2 Aug 2023 10:15:54 -0400 Subject: [PATCH 1/2] Enable demo authorization service test suite --- .../samples-demo-authorizationserver.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/demo-authorizationserver/samples-demo-authorizationserver.gradle b/samples/demo-authorizationserver/samples-demo-authorizationserver.gradle index f7eac0a78..2beea0565 100644 --- a/samples/demo-authorizationserver/samples-demo-authorizationserver.gradle +++ b/samples/demo-authorizationserver/samples-demo-authorizationserver.gradle @@ -30,3 +30,7 @@ dependencies { testImplementation "org.junit.jupiter:junit-jupiter" testImplementation "net.sourceforge.htmlunit:htmlunit" } + +test { + useJUnitPlatform() +} From bbf26c290ca6550eed156e90def2bfab9dd7fe8c Mon Sep 17 00:00:00 2001 From: Dmitriy Dubson Date: Wed, 2 Aug 2023 10:16:33 -0400 Subject: [PATCH 2/2] Fix demo authorization server failing test cases --- .../java/sample/DemoAuthorizationServerApplicationTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java b/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java index 92a3bc5c1..76cc43182 100644 --- a/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java +++ b/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java @@ -75,7 +75,8 @@ public void whenLoginSuccessfulThenDisplayNotFoundError() throws IOException { this.webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); WebResponse signInResponse = signIn(page, "user1", "password").getWebResponse(); - assertThat(signInResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND.value()); // there is no "default" index page + + assertThat(signInResponse.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST.value()); // there is no "default" index page } @Test @@ -86,7 +87,7 @@ public void whenLoginFailsThenDisplayBadCredentials() throws IOException { HtmlElement alert = loginErrorPage.querySelector("div[role=\"alert\"]"); assertThat(alert).isNotNull(); - assertThat(alert.getTextContent()).isEqualTo("Bad credentials"); + assertThat(alert.asNormalizedText()).isEqualTo("Invalid username or password."); } @Test