diff --git a/samples/default-authorizationserver/samples-default-authorizationserver.gradle b/samples/default-authorizationserver/samples-default-authorizationserver.gradle index 3dea316f..e84b55ea 100644 --- a/samples/default-authorizationserver/samples-default-authorizationserver.gradle +++ b/samples/default-authorizationserver/samples-default-authorizationserver.gradle @@ -25,3 +25,7 @@ dependencies { testImplementation "org.junit.jupiter:junit-jupiter" testImplementation "net.sourceforge.htmlunit:htmlunit" } + +tasks.named("test") { + useJUnitPlatform() +} diff --git a/samples/demo-authorizationserver/samples-demo-authorizationserver.gradle b/samples/demo-authorizationserver/samples-demo-authorizationserver.gradle index f7eac0a7..34dc9405 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" } + +tasks.named("test") { + useJUnitPlatform() +} diff --git a/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java b/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java index 92a3bc5c..36d121f0 100644 --- a/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java +++ b/samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java @@ -68,14 +68,15 @@ public class DemoAuthorizationServerApplicationTests { } @Test - public void whenLoginSuccessfulThenDisplayNotFoundError() throws IOException { + public void whenLoginSuccessfulThenDisplayBadRequestError() throws IOException { HtmlPage page = this.webClient.getPage("/"); assertLoginPage(page); 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 class DemoAuthorizationServerApplicationTests { 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