diff --git a/boot/actuator-webmvc-mgmt-port/src/appTest/java/com/example/actuator/webmvc/mgmtport/ActuatorWebMvcMgmtPortApplicationAotTests.java b/boot/actuator-webmvc-mgmt-port/src/appTest/java/com/example/actuator/webmvc/mgmtport/ActuatorWebMvcMgmtPortApplicationAotTests.java
index f46e0e9e..e1b68b08 100644
--- a/boot/actuator-webmvc-mgmt-port/src/appTest/java/com/example/actuator/webmvc/mgmtport/ActuatorWebMvcMgmtPortApplicationAotTests.java
+++ b/boot/actuator-webmvc-mgmt-port/src/appTest/java/com/example/actuator/webmvc/mgmtport/ActuatorWebMvcMgmtPortApplicationAotTests.java
@@ -26,53 +26,105 @@ class ActuatorWebMvcMgmtPortApplicationAotTests {
@Test
void shouldContainLinks() {
- client.get().uri("/actuator").exchange().expectStatus().isOk().expectBody().jsonPath("$._links.self.templated")
- .isEqualTo(false).jsonPath("$._links.env-toMatch.templated").isEqualTo(true);
+ client.get()
+ .uri("/actuator")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$._links.self.templated")
+ .isEqualTo(false)
+ .jsonPath("$._links.env-toMatch.templated")
+ .isEqualTo(true);
}
@Test
void shouldHaveReadiness() {
- client.get().uri("/actuator/health/readiness").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.status").isEqualTo("UP");
+ client.get()
+ .uri("/actuator/health/readiness")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.status")
+ .isEqualTo("UP");
}
@Test
void shouldHaveEnvInfoProperties() {
- client.get().uri("/actuator/info").exchange().expectStatus().isOk().expectBody().jsonPath("$.app.hello")
- .isEqualTo("world");
+ client.get()
+ .uri("/actuator/info")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.app.hello")
+ .isEqualTo("world");
}
@Test
void shouldHaveJavaInfoProperties() {
- client.get().uri("/actuator/info").exchange().expectStatus().isOk().expectBody().jsonPath("$.java.version")
- .isNotEmpty();
+ client.get()
+ .uri("/actuator/info")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.java.version")
+ .isNotEmpty();
}
@Test
void shouldHaveOsInfoProperties() {
- client.get().uri("/actuator/info").exchange().expectStatus().isOk().expectBody().jsonPath("$.os.name")
- .isNotEmpty();
+ client.get()
+ .uri("/actuator/info")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.os.name")
+ .isNotEmpty();
}
@Test
void shouldHaveMetrics() {
- client.get().uri("/actuator/metrics/jvm.classes.loaded").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.measurements.[0].value").isNotEmpty();
+ client.get()
+ .uri("/actuator/metrics/jvm.classes.loaded")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.measurements.[0].value")
+ .isNotEmpty();
}
@Test
void shouldHavePrometheusMetrics() {
- client.get().uri("/actuator/prometheus").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("jvm_classes_loaded_classes "));
+ client.get()
+ .uri("/actuator/prometheus")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .contains("jvm_classes_loaded_classes "));
}
@Test
void shouldHaveLoggers() {
- client.get().uri("/actuator/loggers").exchange().expectStatus().isOk().expectBody().jsonPath("$.levels")
- .isNotEmpty().jsonPath("$.loggers.['ROOT']").isNotEmpty().jsonPath("$.loggers.['_org.springframework']")
- .isNotEmpty();
+ client.get()
+ .uri("/actuator/loggers")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.levels")
+ .isNotEmpty()
+ .jsonPath("$.loggers.['ROOT']")
+ .isNotEmpty()
+ .jsonPath("$.loggers.['_org.springframework']")
+ .isNotEmpty();
}
private static WebTestClient buildManagementClient() {
diff --git a/boot/actuator-webmvc/src/appTest/java/com/example/actuator/webmvc/ActuatorWebMvcApplicationAotTests.java b/boot/actuator-webmvc/src/appTest/java/com/example/actuator/webmvc/ActuatorWebMvcApplicationAotTests.java
index 2dc712ce..8d3b8e00 100644
--- a/boot/actuator-webmvc/src/appTest/java/com/example/actuator/webmvc/ActuatorWebMvcApplicationAotTests.java
+++ b/boot/actuator-webmvc/src/appTest/java/com/example/actuator/webmvc/ActuatorWebMvcApplicationAotTests.java
@@ -12,89 +12,176 @@ class ActuatorWebMvcApplicationAotTests {
@Test
void shouldContainLinks(WebTestClient client) {
- client.get().uri("/actuator").exchange().expectStatus().isOk().expectBody().jsonPath("$._links.self.templated")
- .isEqualTo(false).jsonPath("$._links.env-toMatch.templated").isEqualTo(true);
+ client.get()
+ .uri("/actuator")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$._links.self.templated")
+ .isEqualTo(false)
+ .jsonPath("$._links.env-toMatch.templated")
+ .isEqualTo(true);
}
@Test
void shouldHaveCustomHealthIndicator(WebTestClient client) {
- client.get().uri("/actuator/health").exchange().expectStatus().isOk().expectBody().jsonPath("$.status")
- .isEqualTo("UP").jsonPath("$.components.custom.status").isEqualTo("UP")
- .jsonPath("$.components.custom.details.hello").isEqualTo("world");
+ client.get()
+ .uri("/actuator/health")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.status")
+ .isEqualTo("UP")
+ .jsonPath("$.components.custom.status")
+ .isEqualTo("UP")
+ .jsonPath("$.components.custom.details.hello")
+ .isEqualTo("world");
}
@Test
void shouldHaveAnotherCustomHealthIndicator(WebTestClient client) {
- client.get().uri("/actuator/health").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.components.anotherCustom.status").isEqualTo("UP");
+ client.get()
+ .uri("/actuator/health")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.components.anotherCustom.status")
+ .isEqualTo("UP");
}
@Test
void shouldHaveCompositeHealth(WebTestClient client) {
- client.get().uri("/actuator/health").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.components.composite.status").isEqualTo("UP")
- .jsonPath("$.components.composite.components.another-custom.status").isEqualTo("UP")
- .jsonPath("$.components.composite.components.custom.status").isEqualTo("UP");
+ client.get()
+ .uri("/actuator/health")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.components.composite.status")
+ .isEqualTo("UP")
+ .jsonPath("$.components.composite.components.another-custom.status")
+ .isEqualTo("UP")
+ .jsonPath("$.components.composite.components.custom.status")
+ .isEqualTo("UP");
}
@Test
void shouldHaveCustomEndpoint(WebTestClient client) {
- client.get().uri("/actuator/custom").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("custom-read"));
+ client.get()
+ .uri("/actuator/custom")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("custom-read"));
}
@Test
void shouldHaveCustomWebEndpoint(WebTestClient client) {
- client.get().uri("/actuator/customWeb").exchange().expectStatus().isEqualTo(299).expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("customWeb-read"));
+ client.get()
+ .uri("/actuator/customWeb")
+ .exchange()
+ .expectStatus()
+ .isEqualTo(299)
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("customWeb-read"));
}
@Test
void shouldHaveReadiness(WebTestClient client) {
- client.get().uri("/actuator/health/readiness").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.status").isEqualTo("UP");
+ client.get()
+ .uri("/actuator/health/readiness")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.status")
+ .isEqualTo("UP");
}
@Test
void shouldHaveEnvInfoProperties(WebTestClient client) {
- client.get().uri("/actuator/info").exchange().expectStatus().isOk().expectBody().jsonPath("$.app.hello")
- .isEqualTo("world");
+ client.get()
+ .uri("/actuator/info")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.app.hello")
+ .isEqualTo("world");
}
@Test
void shouldHaveJavaInfoProperties(WebTestClient client) {
- client.get().uri("/actuator/info").exchange().expectStatus().isOk().expectBody().jsonPath("$.java.version")
- .isNotEmpty();
+ client.get()
+ .uri("/actuator/info")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.java.version")
+ .isNotEmpty();
}
@Test
void shouldHaveOsInfoProperties(WebTestClient client) {
- client.get().uri("/actuator/info").exchange().expectStatus().isOk().expectBody().jsonPath("$.os.name")
- .isNotEmpty();
+ client.get()
+ .uri("/actuator/info")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.os.name")
+ .isNotEmpty();
}
@Test
void shouldHaveMetrics(WebTestClient client) {
- client.get().uri("/actuator/metrics/jvm.classes.loaded").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.measurements.[0].value").isNotEmpty();
+ client.get()
+ .uri("/actuator/metrics/jvm.classes.loaded")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.measurements.[0].value")
+ .isNotEmpty();
}
@Test
void prometheusWorks(WebTestClient client) {
- client.get().uri("/actuator/prometheus").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- // Check custom timer
- .contains("custom_timer_seconds_max 5.0").contains("custom_timer_seconds_count 1.0")
- .contains("custom_timer_seconds_sum 5.0")
- // Check JVM metric
- .contains("# TYPE jvm_threads_peak_threads gauge"));
+ client.get()
+ .uri("/actuator/prometheus")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ // Check custom timer
+ .contains("custom_timer_seconds_max 5.0")
+ .contains("custom_timer_seconds_count 1.0")
+ .contains("custom_timer_seconds_sum 5.0")
+ // Check JVM metric
+ .contains("# TYPE jvm_threads_peak_threads gauge"));
}
@Test
void shouldHaveLoggers(WebTestClient client) {
- client.get().uri("/actuator/loggers").exchange().expectStatus().isOk().expectBody().jsonPath("$.levels")
- .isNotEmpty().jsonPath("$.loggers.['ROOT']").isNotEmpty().jsonPath("$.loggers.['_org.springframework']")
- .isNotEmpty();
+ client.get()
+ .uri("/actuator/loggers")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.levels")
+ .isNotEmpty()
+ .jsonPath("$.loggers.['ROOT']")
+ .isNotEmpty()
+ .jsonPath("$.loggers.['_org.springframework']")
+ .isNotEmpty();
}
}
diff --git a/boot/command-line-runner/src/appTest/java/com/example/commandlinerunner/CommandlinerunnerApplicationAotTests.java b/boot/command-line-runner/src/appTest/java/com/example/commandlinerunner/CommandlinerunnerApplicationAotTests.java
index 2d48111a..cb180e38 100644
--- a/boot/command-line-runner/src/appTest/java/com/example/commandlinerunner/CommandlinerunnerApplicationAotTests.java
+++ b/boot/command-line-runner/src/appTest/java/com/example/commandlinerunner/CommandlinerunnerApplicationAotTests.java
@@ -17,9 +17,11 @@ class CommandlinerunnerApplicationAotTests {
void expectedLoggingIsProduced(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("INFO log message")
- .hasSingleLineContaining("WARNING log message").hasSingleLineContaining("ERROR log message")
- .hasNoLinesContaining("TRACE log message").hasNoLinesContaining("DEBUG log message")
- .hasSingleLineContaining("Hello from MyServiceImpl");
+ .hasSingleLineContaining("WARNING log message")
+ .hasSingleLineContaining("ERROR log message")
+ .hasNoLinesContaining("TRACE log message")
+ .hasNoLinesContaining("DEBUG log message")
+ .hasSingleLineContaining("Hello from MyServiceImpl");
});
}
diff --git a/boot/configuration-properties/src/appTest/java/com/example/configprops/ConfigPropsApplicationAotTests.java b/boot/configuration-properties/src/appTest/java/com/example/configprops/ConfigPropsApplicationAotTests.java
index 21dc55ad..bd681413 100644
--- a/boot/configuration-properties/src/appTest/java/com/example/configprops/ConfigPropsApplicationAotTests.java
+++ b/boot/configuration-properties/src/appTest/java/com/example/configprops/ConfigPropsApplicationAotTests.java
@@ -42,7 +42,7 @@ class ConfigPropsApplicationAotTests {
void nestedListShouldBind(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("appProperties.getNestedList(): [Nested{aInt=1}, Nested{aInt=2}]");
+ .hasSingleLineContaining("appProperties.getNestedList(): [Nested{aInt=1}, Nested{aInt=2}]");
});
}
@@ -57,7 +57,7 @@ class ConfigPropsApplicationAotTests {
void nestedMapShouldBind(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("appProperties.getNestedMap(): {a=Nested{aInt=5}, b=Nested{aInt=6}}");
+ .hasSingleLineContaining("appProperties.getNestedMap(): {a=Nested{aInt=5}, b=Nested{aInt=6}}");
});
}
@@ -119,7 +119,7 @@ class ConfigPropsApplicationAotTests {
void nestedListShouldBind(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("appPropertiesCtor.getNestedList(): [Nested{aInt=1}, Nested{aInt=2}]");
+ .hasSingleLineContaining("appPropertiesCtor.getNestedList(): [Nested{aInt=1}, Nested{aInt=2}]");
});
}
@@ -141,7 +141,7 @@ class ConfigPropsApplicationAotTests {
void nestedNotInnerShouldBind(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("appPropertiesCtor.getNestedNotInner(): NestedNotInner{aInt=4}");
+ .hasSingleLineContaining("appPropertiesCtor.getNestedNotInner(): NestedNotInner{aInt=4}");
});
}
@@ -182,7 +182,7 @@ class ConfigPropsApplicationAotTests {
void nestedListShouldBind(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("appPropertiesRecord.nestedList(): [Nested[aInt=1], Nested[aInt=2]]");
+ .hasSingleLineContaining("appPropertiesRecord.nestedList(): [Nested[aInt=1], Nested[aInt=2]]");
});
}
@@ -204,7 +204,7 @@ class ConfigPropsApplicationAotTests {
void nestedNotInnerShouldBind(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("appPropertiesRecord.nestedNotInner(): NestedNotInner{aInt=4}");
+ .hasSingleLineContaining("appPropertiesRecord.nestedNotInner(): NestedNotInner{aInt=4}");
});
}
diff --git a/boot/freemarker-webflux/src/appTest/java/com/example/freemarker/webflux/FreemarkerWebFluxApplicationAotTests.java b/boot/freemarker-webflux/src/appTest/java/com/example/freemarker/webflux/FreemarkerWebFluxApplicationAotTests.java
index 18fd6f02..b46d7cf5 100644
--- a/boot/freemarker-webflux/src/appTest/java/com/example/freemarker/webflux/FreemarkerWebFluxApplicationAotTests.java
+++ b/boot/freemarker-webflux/src/appTest/java/com/example/freemarker/webflux/FreemarkerWebFluxApplicationAotTests.java
@@ -12,15 +12,26 @@ class FreemarkerWebFluxApplicationAotTests {
@Test
void greetingIsRendered(WebTestClient client) {
- client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
+ client.get()
+ .uri("/greeting")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
}
@Test
void authorListIsRendered(WebTestClient client) {
- client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("
Brian Goetz").contains("Joshua Bloch"));
+ client.get()
+ .uri("/authors")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Brian Goetz")
+ .contains("Joshua Bloch"));
}
}
diff --git a/boot/freemarker-webmvc/src/appTest/java/com/example/freemarker/webmvc/FreemarkerWebMvcApplicationAotTests.java b/boot/freemarker-webmvc/src/appTest/java/com/example/freemarker/webmvc/FreemarkerWebMvcApplicationAotTests.java
index fc855c5e..5418de2d 100644
--- a/boot/freemarker-webmvc/src/appTest/java/com/example/freemarker/webmvc/FreemarkerWebMvcApplicationAotTests.java
+++ b/boot/freemarker-webmvc/src/appTest/java/com/example/freemarker/webmvc/FreemarkerWebMvcApplicationAotTests.java
@@ -12,15 +12,26 @@ class FreemarkerWebMvcApplicationAotTests {
@Test
void greetingIsRendered(WebTestClient client) {
- client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
+ client.get()
+ .uri("/greeting")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
}
@Test
void authorListIsRendered(WebTestClient client) {
- client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Brian Goetz").contains("Joshua Bloch"));
+ client.get()
+ .uri("/authors")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Brian Goetz")
+ .contains("Joshua Bloch"));
}
}
diff --git a/boot/liquibase/src/appTest/java/com/example/liquibase/LiquibaseApplicationAotTests.java b/boot/liquibase/src/appTest/java/com/example/liquibase/LiquibaseApplicationAotTests.java
index 2c67f970..9b7e92d8 100644
--- a/boot/liquibase/src/appTest/java/com/example/liquibase/LiquibaseApplicationAotTests.java
+++ b/boot/liquibase/src/appTest/java/com/example/liquibase/LiquibaseApplicationAotTests.java
@@ -16,12 +16,12 @@ class LiquibaseApplicationAotTests {
@Test
void liquibaseRan(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
- assertThat(output).hasSingleLineContaining(
- "ChangeSet db/changelog/changelogs/1.yaml::1::nvoxland ran successfully in");
- assertThat(output).hasSingleLineContaining(
- "ChangeSet db/changelog/changelogs/2.yaml::2::nvoxland ran successfully in");
- assertThat(output).hasSingleLineContaining(
- "ChangeSet db/changelog/changelogs/3.yaml::3::nvoxland ran successfully in");
+ assertThat(output)
+ .hasSingleLineContaining("ChangeSet db/changelog/changelogs/1.yaml::1::nvoxland ran successfully in");
+ assertThat(output)
+ .hasSingleLineContaining("ChangeSet db/changelog/changelogs/2.yaml::2::nvoxland ran successfully in");
+ assertThat(output)
+ .hasSingleLineContaining("ChangeSet db/changelog/changelogs/3.yaml::3::nvoxland ran successfully in");
});
}
diff --git a/boot/logging-logback-spring-xml/src/appTest/java/com/example/logbackspring/xml/LogbackXmlApplicationAotTests.java b/boot/logging-logback-spring-xml/src/appTest/java/com/example/logbackspring/xml/LogbackXmlApplicationAotTests.java
index 773da93c..22394796 100644
--- a/boot/logging-logback-spring-xml/src/appTest/java/com/example/logbackspring/xml/LogbackXmlApplicationAotTests.java
+++ b/boot/logging-logback-spring-xml/src/appTest/java/com/example/logbackspring/xml/LogbackXmlApplicationAotTests.java
@@ -21,15 +21,14 @@ class LogbackXmlApplicationAotTests {
void expectedLoggingIsProduced(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(output).hasNoLinesContaining("Trace message")
- .hasSingleLineContaining("main | DEBUG | com.example.logbackspring.xml.CLR | Debug message")
- .hasSingleLineContaining("main | INFO | com.example.logbackspring.xml.CLR | Info message")
- .hasSingleLineContaining("main | WARN | com.example.logbackspring.xml.CLR | Warn message")
- .hasSingleLineContaining("main | ERROR | com.example.logbackspring.xml.CLR | Error message")
- .hasSingleLineContaining(
- "main | INFO | com.example.logbackspring.xml.CLR | Info with parameters: 1")
- .hasSingleLineContaining("main | ERROR | com.example.logbackspring.xml.CLR | Error with stacktrace")
- .hasSingleLineContaining("java.lang.RuntimeException: Boom")
- .hasSingleLineContaining("at com.example.logbackspring.xml.CLR.run(CLR.java");
+ .hasSingleLineContaining("main | DEBUG | com.example.logbackspring.xml.CLR | Debug message")
+ .hasSingleLineContaining("main | INFO | com.example.logbackspring.xml.CLR | Info message")
+ .hasSingleLineContaining("main | WARN | com.example.logbackspring.xml.CLR | Warn message")
+ .hasSingleLineContaining("main | ERROR | com.example.logbackspring.xml.CLR | Error message")
+ .hasSingleLineContaining("main | INFO | com.example.logbackspring.xml.CLR | Info with parameters: 1")
+ .hasSingleLineContaining("main | ERROR | com.example.logbackspring.xml.CLR | Error with stacktrace")
+ .hasSingleLineContaining("java.lang.RuntimeException: Boom")
+ .hasSingleLineContaining("at com.example.logbackspring.xml.CLR.run(CLR.java");
});
}
diff --git a/boot/logging-logback-xml/src/appTest/java/com/example/logback/xml/LogbackXmlApplicationAotTests.java b/boot/logging-logback-xml/src/appTest/java/com/example/logback/xml/LogbackXmlApplicationAotTests.java
index d68e053e..9ed811e5 100644
--- a/boot/logging-logback-xml/src/appTest/java/com/example/logback/xml/LogbackXmlApplicationAotTests.java
+++ b/boot/logging-logback-xml/src/appTest/java/com/example/logback/xml/LogbackXmlApplicationAotTests.java
@@ -21,14 +21,14 @@ class LogbackXmlApplicationAotTests {
void expectedLoggingIsProduced(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(output).hasNoLinesContaining("Trace message")
- .hasSingleLineContaining("main | DEBUG | com.example.logback.xml.CLR | Debug message")
- .hasSingleLineContaining("main | INFO | com.example.logback.xml.CLR | Info message")
- .hasSingleLineContaining("main | WARN | com.example.logback.xml.CLR | Warn message")
- .hasSingleLineContaining("main | ERROR | com.example.logback.xml.CLR | Error message")
- .hasSingleLineContaining("main | INFO | com.example.logback.xml.CLR | Info with parameters: 1")
- .hasSingleLineContaining("main | ERROR | com.example.logback.xml.CLR | Error with stacktrace")
- .hasSingleLineContaining("java.lang.RuntimeException: Boom")
- .hasSingleLineContaining("at com.example.logback.xml.CLR.run(CLR.java");
+ .hasSingleLineContaining("main | DEBUG | com.example.logback.xml.CLR | Debug message")
+ .hasSingleLineContaining("main | INFO | com.example.logback.xml.CLR | Info message")
+ .hasSingleLineContaining("main | WARN | com.example.logback.xml.CLR | Warn message")
+ .hasSingleLineContaining("main | ERROR | com.example.logback.xml.CLR | Error message")
+ .hasSingleLineContaining("main | INFO | com.example.logback.xml.CLR | Info with parameters: 1")
+ .hasSingleLineContaining("main | ERROR | com.example.logback.xml.CLR | Error with stacktrace")
+ .hasSingleLineContaining("java.lang.RuntimeException: Boom")
+ .hasSingleLineContaining("at com.example.logback.xml.CLR.run(CLR.java");
});
}
diff --git a/boot/logging-logback/src/appTest/java/com/example/logback/LogbackApplicationAotTests.java b/boot/logging-logback/src/appTest/java/com/example/logback/LogbackApplicationAotTests.java
index 55703561..d67dd3df 100644
--- a/boot/logging-logback/src/appTest/java/com/example/logback/LogbackApplicationAotTests.java
+++ b/boot/logging-logback/src/appTest/java/com/example/logback/LogbackApplicationAotTests.java
@@ -16,12 +16,15 @@ class LogbackApplicationAotTests {
@Test
void expectedLoggingIsProduced(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
- assertThat(output).hasNoLinesContaining("Trace message").hasSingleLineContaining("Debug message")
- .hasSingleLineContaining("Info message").hasSingleLineContaining("Warn message")
- .hasSingleLineContaining("Error message").hasSingleLineContaining("Info with parameters: 1")
- .hasSingleLineContaining("Error with stacktrace")
- .hasSingleLineContaining("java.lang.RuntimeException: Boom")
- .hasSingleLineContaining("at com.example.logback.CLR.run(CLR.java");
+ assertThat(output).hasNoLinesContaining("Trace message")
+ .hasSingleLineContaining("Debug message")
+ .hasSingleLineContaining("Info message")
+ .hasSingleLineContaining("Warn message")
+ .hasSingleLineContaining("Error message")
+ .hasSingleLineContaining("Info with parameters: 1")
+ .hasSingleLineContaining("Error with stacktrace")
+ .hasSingleLineContaining("java.lang.RuntimeException: Boom")
+ .hasSingleLineContaining("at com.example.logback.CLR.run(CLR.java");
});
}
diff --git a/boot/mustache-webflux/src/appTest/java/com/example/mustache/webflux/MustacheWebFluxApplicationAotTests.java b/boot/mustache-webflux/src/appTest/java/com/example/mustache/webflux/MustacheWebFluxApplicationAotTests.java
index 4b9758c0..7ad8ed0c 100644
--- a/boot/mustache-webflux/src/appTest/java/com/example/mustache/webflux/MustacheWebFluxApplicationAotTests.java
+++ b/boot/mustache-webflux/src/appTest/java/com/example/mustache/webflux/MustacheWebFluxApplicationAotTests.java
@@ -12,15 +12,26 @@ class MustacheWebFluxApplicationAotTests {
@Test
void greetingIsRendered(WebTestClient client) {
- client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
+ client.get()
+ .uri("/greeting")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
}
@Test
void authorListIsRendered(WebTestClient client) {
- client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Brian Goetz").contains("Joshua Bloch"));
+ client.get()
+ .uri("/authors")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Brian Goetz")
+ .contains("Joshua Bloch"));
}
}
diff --git a/boot/mustache-webmvc/src/appTest/java/com/example/mustache/webmvc/MustacheWebMvcApplicationAotTests.java b/boot/mustache-webmvc/src/appTest/java/com/example/mustache/webmvc/MustacheWebMvcApplicationAotTests.java
index 396cd111..541f0069 100644
--- a/boot/mustache-webmvc/src/appTest/java/com/example/mustache/webmvc/MustacheWebMvcApplicationAotTests.java
+++ b/boot/mustache-webmvc/src/appTest/java/com/example/mustache/webmvc/MustacheWebMvcApplicationAotTests.java
@@ -12,15 +12,26 @@ class MustacheWebMvcApplicationAotTests {
@Test
void greetingIsRendered(WebTestClient client) {
- client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
+ client.get()
+ .uri("/greeting")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello world"));
}
@Test
void authorListIsRendered(WebTestClient client) {
- client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Brian Goetz").contains("Joshua Bloch"));
+ client.get()
+ .uri("/authors")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Brian Goetz")
+ .contains("Joshua Bloch"));
}
}
diff --git a/boot/servlet-jetty/src/appTest/java/com/example/servlet/jetty/ServletJettyApplicationAotTests.java b/boot/servlet-jetty/src/appTest/java/com/example/servlet/jetty/ServletJettyApplicationAotTests.java
index ecd005ac..daae75fa 100644
--- a/boot/servlet-jetty/src/appTest/java/com/example/servlet/jetty/ServletJettyApplicationAotTests.java
+++ b/boot/servlet-jetty/src/appTest/java/com/example/servlet/jetty/ServletJettyApplicationAotTests.java
@@ -12,8 +12,14 @@ class ServletJettyApplicationAotTests {
@Test
void servletIsInvokable(WebTestClient client) {
- client.get().uri("/?name=Servlet").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello Servlet"));
+ client.get()
+ .uri("/?name=Servlet")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello Servlet"));
}
}
diff --git a/boot/servlet-tomcat/src/appTest/java/com/example/servlet/tomcat/ServletTomcatApplicationAotTests.java b/boot/servlet-tomcat/src/appTest/java/com/example/servlet/tomcat/ServletTomcatApplicationAotTests.java
index a8df366d..3768c51b 100644
--- a/boot/servlet-tomcat/src/appTest/java/com/example/servlet/tomcat/ServletTomcatApplicationAotTests.java
+++ b/boot/servlet-tomcat/src/appTest/java/com/example/servlet/tomcat/ServletTomcatApplicationAotTests.java
@@ -12,8 +12,14 @@ class ServletTomcatApplicationAotTests {
@Test
void servletIsInvokable(WebTestClient client) {
- client.get().uri("/?name=Servlet").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello Servlet"));
+ client.get()
+ .uri("/?name=Servlet")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello Servlet"));
}
}
diff --git a/boot/servlet-undertow/src/appTest/java/com/example/servlet/undertow/ServletUndertowApplicationAotTests.java b/boot/servlet-undertow/src/appTest/java/com/example/servlet/undertow/ServletUndertowApplicationAotTests.java
index b1c27006..e3e2b462 100644
--- a/boot/servlet-undertow/src/appTest/java/com/example/servlet/undertow/ServletUndertowApplicationAotTests.java
+++ b/boot/servlet-undertow/src/appTest/java/com/example/servlet/undertow/ServletUndertowApplicationAotTests.java
@@ -12,8 +12,14 @@ class ServletUndertowApplicationAotTests {
@Test
void servletIsInvokable(WebTestClient client) {
- client.get().uri("/?name=Servlet").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello Servlet"));
+ client.get()
+ .uri("/?name=Servlet")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello Servlet"));
}
}
diff --git a/boot/thymeleaf-webflux/src/appTest/java/com/example/thymeleaf/webflux/ThymeleafWebFluxApplicationAotTests.java b/boot/thymeleaf-webflux/src/appTest/java/com/example/thymeleaf/webflux/ThymeleafWebFluxApplicationAotTests.java
index 4b14222f..eac0bd9a 100644
--- a/boot/thymeleaf-webflux/src/appTest/java/com/example/thymeleaf/webflux/ThymeleafWebFluxApplicationAotTests.java
+++ b/boot/thymeleaf-webflux/src/appTest/java/com/example/thymeleaf/webflux/ThymeleafWebFluxApplicationAotTests.java
@@ -12,16 +12,28 @@ class ThymeleafWebFluxApplicationAotTests {
@Test
void greetingIsRendered(WebTestClient client) {
- client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Hello").contains("world"));
+ client.get()
+ .uri("/greeting")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello")
+ .contains("world"));
}
@Test
void authorListIsRendered(WebTestClient client) {
- client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Brian Goetz").contains("Joshua Bloch"));
+ client.get()
+ .uri("/authors")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Brian Goetz")
+ .contains("Joshua Bloch"));
}
}
diff --git a/boot/thymeleaf-webmvc/src/appTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java b/boot/thymeleaf-webmvc/src/appTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java
index 3d96d663..52a15388 100644
--- a/boot/thymeleaf-webmvc/src/appTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java
+++ b/boot/thymeleaf-webmvc/src/appTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java
@@ -12,16 +12,28 @@ class ThymeleafWebMvcApplicationAotTests {
@Test
void greetingIsRendered(WebTestClient client) {
- client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Hello").contains("world"));
+ client.get()
+ .uri("/greeting")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Hello")
+ .contains("world"));
}
@Test
void authorListIsRendered(WebTestClient client) {
- client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Brian Goetz").contains("Joshua Bloch"));
+ client.get()
+ .uri("/authors")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).contains("Brian Goetz")
+ .contains("Joshua Bloch"));
}
}
diff --git a/boot/tracing-brave-zipkin/src/appTest/java/com/example/tracing/brave/zipkin/TracingBraveZipkinApplicationAotTests.java b/boot/tracing-brave-zipkin/src/appTest/java/com/example/tracing/brave/zipkin/TracingBraveZipkinApplicationAotTests.java
index 98cbe25f..cb32e62b 100644
--- a/boot/tracing-brave-zipkin/src/appTest/java/com/example/tracing/brave/zipkin/TracingBraveZipkinApplicationAotTests.java
+++ b/boot/tracing-brave-zipkin/src/appTest/java/com/example/tracing/brave/zipkin/TracingBraveZipkinApplicationAotTests.java
@@ -21,16 +21,26 @@ class TracingBraveZipkinApplicationAotTests {
void checkSpanInZipkin(@DockerComposeHost("zipkin") String zipkinHost,
@DockerComposePort(service = "zipkin", port = 9411) int zipkinPort) {
WebTestClient client = WebTestClient.bindToServer(new JdkClientHttpConnector())
- .baseUrl("http://%s:%d/".formatted(zipkinHost, zipkinPort)).build();
+ .baseUrl("http://%s:%d/".formatted(zipkinHost, zipkinPort))
+ .build();
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
- client.get().uri("/zipkin/api/v2/traces?limit=1").exchange().expectBody().jsonPath("$[0][0].traceId")
- .isNotEmpty().jsonPath("$[0][0].name").isEqualTo("test-observation")
- .jsonPath("$[0][0].localEndpoint.serviceName").isEqualTo("tracing-brave-zipkin")
- .jsonPath("$[0][0].tags.key-1").isEqualTo("value-1").jsonPath("$[0][0].duration")
- .value((duration) -> {
- assertThat(duration).asInstanceOf(InstanceOfAssertFactories.INTEGER)
- .isGreaterThanOrEqualTo((int) Duration.ofSeconds(2).toMillis());
- });
+ client.get()
+ .uri("/zipkin/api/v2/traces?limit=1")
+ .exchange()
+ .expectBody()
+ .jsonPath("$[0][0].traceId")
+ .isNotEmpty()
+ .jsonPath("$[0][0].name")
+ .isEqualTo("test-observation")
+ .jsonPath("$[0][0].localEndpoint.serviceName")
+ .isEqualTo("tracing-brave-zipkin")
+ .jsonPath("$[0][0].tags.key-1")
+ .isEqualTo("value-1")
+ .jsonPath("$[0][0].duration")
+ .value((duration) -> {
+ assertThat(duration).asInstanceOf(InstanceOfAssertFactories.INTEGER)
+ .isGreaterThanOrEqualTo((int) Duration.ofSeconds(2).toMillis());
+ });
});
}
diff --git a/cloud/cloud-config-client/src/appTest/java/com/example/cloud/config/client/ConfigClientApplicationAotTests.java b/cloud/cloud-config-client/src/appTest/java/com/example/cloud/config/client/ConfigClientApplicationAotTests.java
index 1bc81348..b87e75e3 100644
--- a/cloud/cloud-config-client/src/appTest/java/com/example/cloud/config/client/ConfigClientApplicationAotTests.java
+++ b/cloud/cloud-config-client/src/appTest/java/com/example/cloud/config/client/ConfigClientApplicationAotTests.java
@@ -18,7 +18,7 @@ public class ConfigClientApplicationAotTests {
Awaitility.await().atMost(30, TimeUnit.SECONDS).untilAsserted(() -> {
assertThat(output).hasLineContaining("Fetching config from server");
assertThat(output)
- .hasLineContaining("Located environment: name=client-service, profiles=[default], label=null");
+ .hasLineContaining("Located environment: name=client-service, profiles=[default], label=null");
});
}
diff --git a/cloud/cloud-discovery-zookeeper/src/appTest/java/com/example/cloud/discovery/zookeeper/ZookeeperDiscoveryClientApplicationAotTests.java b/cloud/cloud-discovery-zookeeper/src/appTest/java/com/example/cloud/discovery/zookeeper/ZookeeperDiscoveryClientApplicationAotTests.java
index e7b04155..a07dc910 100644
--- a/cloud/cloud-discovery-zookeeper/src/appTest/java/com/example/cloud/discovery/zookeeper/ZookeeperDiscoveryClientApplicationAotTests.java
+++ b/cloud/cloud-discovery-zookeeper/src/appTest/java/com/example/cloud/discovery/zookeeper/ZookeeperDiscoveryClientApplicationAotTests.java
@@ -15,8 +15,9 @@ class ZookeeperDiscoveryClientApplicationAotTests {
@Test
void shouldRegisterWithZookeeper(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> assertThat(output).hasLineContaining("Session establishment complete on server"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasLineContaining("Session establishment complete on server"));
}
diff --git a/cloud/cloud-function-web/src/appTest/java/com/example/cloud/function/web/CloudFunctionWebApplicationAotTests.java b/cloud/cloud-function-web/src/appTest/java/com/example/cloud/function/web/CloudFunctionWebApplicationAotTests.java
index 0606590d..2673354a 100644
--- a/cloud/cloud-function-web/src/appTest/java/com/example/cloud/function/web/CloudFunctionWebApplicationAotTests.java
+++ b/cloud/cloud-function-web/src/appTest/java/com/example/cloud/function/web/CloudFunctionWebApplicationAotTests.java
@@ -13,16 +13,28 @@ class CloudFunctionWebApplicationAotTests {
@Test
void uppercaseShouldBeInvokable(WebTestClient webTestClient) {
- webTestClient.post().uri("/uppercase").header("Content-Type", MediaType.TEXT_PLAIN_VALUE).bodyValue("hello")
- .exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("HELLO"));
+ webTestClient.post()
+ .uri("/uppercase")
+ .header("Content-Type", MediaType.TEXT_PLAIN_VALUE)
+ .bodyValue("hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("HELLO"));
}
@Test
void lowercaseShouldBeInvokable(WebTestClient webTestClient) {
- webTestClient.post().uri("/lowercase").header("Content-Type", MediaType.TEXT_PLAIN_VALUE).bodyValue("HELLO")
- .exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hello"));
+ webTestClient.post()
+ .uri("/lowercase")
+ .header("Content-Type", MediaType.TEXT_PLAIN_VALUE)
+ .bodyValue("HELLO")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hello"));
}
}
diff --git a/cloud/cloud-function-webflux/src/appTest/java/com/example/cloud/function/webflux/CloudFunctionWebFluxApplicationAotTests.java b/cloud/cloud-function-webflux/src/appTest/java/com/example/cloud/function/webflux/CloudFunctionWebFluxApplicationAotTests.java
index 132ab978..ca280477 100644
--- a/cloud/cloud-function-webflux/src/appTest/java/com/example/cloud/function/webflux/CloudFunctionWebFluxApplicationAotTests.java
+++ b/cloud/cloud-function-webflux/src/appTest/java/com/example/cloud/function/webflux/CloudFunctionWebFluxApplicationAotTests.java
@@ -13,16 +13,28 @@ class CloudFunctionWebFluxApplicationAotTests {
@Test
void uppercaseShouldBeInvokable(WebTestClient webTestClient) {
- webTestClient.post().uri("/uppercase").header("Content-Type", MediaType.TEXT_PLAIN_VALUE).bodyValue("hello")
- .exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("HELLO"));
+ webTestClient.post()
+ .uri("/uppercase")
+ .header("Content-Type", MediaType.TEXT_PLAIN_VALUE)
+ .bodyValue("hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("HELLO"));
}
@Test
void lowercaseShouldBeInvokable(WebTestClient webTestClient) {
- webTestClient.post().uri("/lowercase").header("Content-Type", MediaType.TEXT_PLAIN_VALUE).bodyValue("HELLO")
- .exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hello"));
+ webTestClient.post()
+ .uri("/lowercase")
+ .header("Content-Type", MediaType.TEXT_PLAIN_VALUE)
+ .bodyValue("HELLO")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hello"));
}
}
diff --git a/cloud/cloud-gateway/src/appTest/java/com/example/cloud/gateway/CloudGatewayApplicationAotTests.java b/cloud/cloud-gateway/src/appTest/java/com/example/cloud/gateway/CloudGatewayApplicationAotTests.java
index e34842ec..b1d5d856 100644
--- a/cloud/cloud-gateway/src/appTest/java/com/example/cloud/gateway/CloudGatewayApplicationAotTests.java
+++ b/cloud/cloud-gateway/src/appTest/java/com/example/cloud/gateway/CloudGatewayApplicationAotTests.java
@@ -12,10 +12,20 @@ public class CloudGatewayApplicationAotTests {
@Test
void shouldRouteRequests(WebTestClient client) {
- client.get().uri("test-service").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("test"));
- client.get().uri("demo-service").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("demo"));
+ client.get()
+ .uri("test-service")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("test"));
+ client.get()
+ .uri("demo-service")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("demo"));
}
}
diff --git a/cloud/cloud-stream-kafka/src/appTest/java/com/example/cloud/stream/kafka/SpringCloudStreamKafkaApplicationAotTests.java b/cloud/cloud-stream-kafka/src/appTest/java/com/example/cloud/stream/kafka/SpringCloudStreamKafkaApplicationAotTests.java
index 11864c81..d13cf324 100644
--- a/cloud/cloud-stream-kafka/src/appTest/java/com/example/cloud/stream/kafka/SpringCloudStreamKafkaApplicationAotTests.java
+++ b/cloud/cloud-stream-kafka/src/appTest/java/com/example/cloud/stream/kafka/SpringCloudStreamKafkaApplicationAotTests.java
@@ -33,13 +33,18 @@ class SpringCloudStreamKafkaApplicationAotTests {
void suppliedMessageIsUppercasedAndLogged(AssertableOutput output) {
// INPUT -> How much wood could a woodchuck chuck if a woodchuck could chuck
// wood?"
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> assertThat(output).hasLineContaining("++++++Received:HOW")
- .hasLineContaining("++++++Received:MUCH").hasLineContaining("++++++Received:WOOD")
- .hasLineContaining("++++++Received:COULD").hasLineContaining("++++++Received:A")
- .hasLineContaining("++++++Received:WOODCHUCK").hasLineContaining("++++++Received:CHUCK")
- .hasLineContaining("++++++Received:IF").hasLineContaining("++++++Received:COULD")
- .hasLineContaining("++++++Received:WOOD?"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasLineContaining("++++++Received:HOW")
+ .hasLineContaining("++++++Received:MUCH")
+ .hasLineContaining("++++++Received:WOOD")
+ .hasLineContaining("++++++Received:COULD")
+ .hasLineContaining("++++++Received:A")
+ .hasLineContaining("++++++Received:WOODCHUCK")
+ .hasLineContaining("++++++Received:CHUCK")
+ .hasLineContaining("++++++Received:IF")
+ .hasLineContaining("++++++Received:COULD")
+ .hasLineContaining("++++++Received:WOOD?"));
}
}
diff --git a/cloud/cloud-stream-rabbit/src/appTest/java/com/example/cloud/stream/rabbit/SpringCloudStreamRabbitApplicationAotTests.java b/cloud/cloud-stream-rabbit/src/appTest/java/com/example/cloud/stream/rabbit/SpringCloudStreamRabbitApplicationAotTests.java
index f2f10d71..14b4d6f2 100644
--- a/cloud/cloud-stream-rabbit/src/appTest/java/com/example/cloud/stream/rabbit/SpringCloudStreamRabbitApplicationAotTests.java
+++ b/cloud/cloud-stream-rabbit/src/appTest/java/com/example/cloud/stream/rabbit/SpringCloudStreamRabbitApplicationAotTests.java
@@ -32,13 +32,18 @@ class SpringCloudStreamRabbitApplicationAotTests {
void suppliedMessageIsUppercasedAndLogged(AssertableOutput output) {
// INPUT -> How much wood could a woodchuck chuck if a woodchuck could chuck
// wood?"
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> assertThat(output).hasLineContaining("++++++Received:HOW")
- .hasLineContaining("++++++Received:MUCH").hasLineContaining("++++++Received:WOOD")
- .hasLineContaining("++++++Received:COULD").hasLineContaining("++++++Received:A")
- .hasLineContaining("++++++Received:WOODCHUCK").hasLineContaining("++++++Received:CHUCK")
- .hasLineContaining("++++++Received:IF").hasLineContaining("++++++Received:COULD")
- .hasLineContaining("++++++Received:WOOD?"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasLineContaining("++++++Received:HOW")
+ .hasLineContaining("++++++Received:MUCH")
+ .hasLineContaining("++++++Received:WOOD")
+ .hasLineContaining("++++++Received:COULD")
+ .hasLineContaining("++++++Received:A")
+ .hasLineContaining("++++++Received:WOODCHUCK")
+ .hasLineContaining("++++++Received:CHUCK")
+ .hasLineContaining("++++++Received:IF")
+ .hasLineContaining("++++++Received:COULD")
+ .hasLineContaining("++++++Received:WOOD?"));
}
}
diff --git a/cloud/cloud-task/src/appTest/java/com/example/cloud/task/CloudTaskApplicationAotTests.java b/cloud/cloud-task/src/appTest/java/com/example/cloud/task/CloudTaskApplicationAotTests.java
index 24be4cac..d2f83ab8 100644
--- a/cloud/cloud-task/src/appTest/java/com/example/cloud/task/CloudTaskApplicationAotTests.java
+++ b/cloud/cloud-task/src/appTest/java/com/example/cloud/task/CloudTaskApplicationAotTests.java
@@ -16,8 +16,9 @@ class CloudTaskApplicationAotTests {
@Test
void expectedLoggingIsProduced(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
- assertThat(output).hasSingleLineContaining("Before task: cloudtask").hasSingleLineContaining("Task ran!")
- .hasSingleLineContaining("After task: cloudtask");
+ assertThat(output).hasSingleLineContaining("Before task: cloudtask")
+ .hasSingleLineContaining("Task ran!")
+ .hasSingleLineContaining("After task: cloudtask");
});
}
diff --git a/data/data-cassandra-reactive/src/appTest/java/com/example/data/cassandra/reactive/DataCassandraReactiveApplicationAotTests.java b/data/data-cassandra-reactive/src/appTest/java/com/example/data/cassandra/reactive/DataCassandraReactiveApplicationAotTests.java
index e3a97f73..f609b383 100644
--- a/data/data-cassandra-reactive/src/appTest/java/com/example/data/cassandra/reactive/DataCassandraReactiveApplicationAotTests.java
+++ b/data/data-cassandra-reactive/src/appTest/java/com/example/data/cassandra/reactive/DataCassandraReactiveApplicationAotTests.java
@@ -17,8 +17,8 @@ class DataCassandraReactiveApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findAll(): Person{firstname='first-1', lastname='last-1'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
+ .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
});
}
@@ -26,7 +26,7 @@ class DataCassandraReactiveApplicationAotTests {
void findByLastName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
});
}
diff --git a/data/data-cassandra/src/appTest/java/com/example/data/cassandra/DataCassandraApplicationAotTests.java b/data/data-cassandra/src/appTest/java/com/example/data/cassandra/DataCassandraApplicationAotTests.java
index b7d4d8ee..a73cad67 100644
--- a/data/data-cassandra/src/appTest/java/com/example/data/cassandra/DataCassandraApplicationAotTests.java
+++ b/data/data-cassandra/src/appTest/java/com/example/data/cassandra/DataCassandraApplicationAotTests.java
@@ -51,8 +51,8 @@ class DataCassandraApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findAll(): Person{firstname='first-1', lastname='last-1'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
+ .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
});
}
@@ -60,7 +60,7 @@ class DataCassandraApplicationAotTests {
void findByLastName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
});
}
diff --git a/data/data-jdbc-h2-kotlin/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java b/data/data-jdbc-h2-kotlin/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java
index b2dc6536..a247a490 100644
--- a/data/data-jdbc-h2-kotlin/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java
+++ b/data/data-jdbc-h2-kotlin/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java
@@ -17,7 +17,7 @@ class DataJdbcH2ApplicationAotTests {
void insert(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("insertAuthors(): author1 = Author(name='Josh Long')")
- .hasSingleLineContaining("insertAuthors(): author2 = Author(name='Martin Kleppmann')");
+ .hasSingleLineContaining("insertAuthors(): author2 = Author(name='Martin Kleppmann')");
});
}
@@ -25,10 +25,10 @@ class DataJdbcH2ApplicationAotTests {
void listAllAuthors(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("listAllAuthors(): author = Author(name='Josh Long')")
- .hasSingleLineContaining("Book(title='Cloud Native Java')")
- .hasSingleLineContaining("Book(title='Reactive Spring')")
- .hasSingleLineContaining("listAllAuthors(): author = Author(name='Martin Kleppmann')")
- .hasSingleLineContaining("Book(title='Designing Data Intensive Applications')");
+ .hasSingleLineContaining("Book(title='Cloud Native Java')")
+ .hasSingleLineContaining("Book(title='Reactive Spring')")
+ .hasSingleLineContaining("listAllAuthors(): author = Author(name='Martin Kleppmann')")
+ .hasSingleLineContaining("Book(title='Designing Data Intensive Applications')");
});
}
@@ -36,7 +36,7 @@ class DataJdbcH2ApplicationAotTests {
void findById(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findById(): author1 = Author(name='Josh Long')")
- .hasSingleLineContaining("findById(): author2 = Author(name='Martin Kleppmann')");
+ .hasSingleLineContaining("findById(): author2 = Author(name='Martin Kleppmann')");
});
}
@@ -44,7 +44,7 @@ class DataJdbcH2ApplicationAotTests {
void queryDerivedFromMethodName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findByPartialName(): author1 = Author(name='Josh Long')")
- .hasSingleLineContaining("findByPartialName(): author2 = Author(name='Martin Kleppmann')");
+ .hasSingleLineContaining("findByPartialName(): author2 = Author(name='Martin Kleppmann')");
});
}
@@ -52,7 +52,7 @@ class DataJdbcH2ApplicationAotTests {
void queryAnnotatedMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("queryFindByName(): author1 = Author(name='Josh Long')")
- .hasSingleLineContaining("queryFindByName(): author2 = Author(name='Martin Kleppmann')");
+ .hasSingleLineContaining("queryFindByName(): author2 = Author(name='Martin Kleppmann')");
});
}
diff --git a/data/data-jdbc-h2/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java b/data/data-jdbc-h2/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java
index c799989c..1155922e 100644
--- a/data/data-jdbc-h2/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java
+++ b/data/data-jdbc-h2/src/appTest/java/com/example/data/jdbc/h2/DataJdbcH2ApplicationAotTests.java
@@ -17,7 +17,7 @@ class DataJdbcH2ApplicationAotTests {
void insert(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("insertAuthors(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -25,10 +25,10 @@ class DataJdbcH2ApplicationAotTests {
void listAllAuthors(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("listAllAuthors(): author = Author{name='Josh Long'")
- .hasSingleLineContaining("Book{title='Cloud Native Java'}")
- .hasSingleLineContaining("Book{title='Reactive Spring'}")
- .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
- .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'}");
+ .hasSingleLineContaining("Book{title='Cloud Native Java'}")
+ .hasSingleLineContaining("Book{title='Reactive Spring'}")
+ .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
+ .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'}");
});
}
@@ -36,7 +36,7 @@ class DataJdbcH2ApplicationAotTests {
void findById(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findById(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -44,7 +44,7 @@ class DataJdbcH2ApplicationAotTests {
void queryDerivedFromMethodName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findByPartialName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -52,7 +52,7 @@ class DataJdbcH2ApplicationAotTests {
void queryAnnotatedMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("queryFindByName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
});
}
diff --git a/data/data-jdbc-postgresql/src/appTest/java/com/example/data/jdbc/postgresql/DataJdbcPostgreSQLApplicationAotTests.java b/data/data-jdbc-postgresql/src/appTest/java/com/example/data/jdbc/postgresql/DataJdbcPostgreSQLApplicationAotTests.java
index aa69de8d..ed26d1c3 100644
--- a/data/data-jdbc-postgresql/src/appTest/java/com/example/data/jdbc/postgresql/DataJdbcPostgreSQLApplicationAotTests.java
+++ b/data/data-jdbc-postgresql/src/appTest/java/com/example/data/jdbc/postgresql/DataJdbcPostgreSQLApplicationAotTests.java
@@ -17,7 +17,7 @@ class DataJdbcPostgreSQLApplicationAotTests {
void insert(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("insertAuthors(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -25,10 +25,10 @@ class DataJdbcPostgreSQLApplicationAotTests {
void listAllAuthors(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("listAllAuthors(): author = Author{name='Josh Long'")
- .hasSingleLineContaining("Book{title='Cloud Native Java'}")
- .hasSingleLineContaining("Book{title='Reactive Spring'}")
- .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
- .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'}");
+ .hasSingleLineContaining("Book{title='Cloud Native Java'}")
+ .hasSingleLineContaining("Book{title='Reactive Spring'}")
+ .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
+ .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'}");
});
}
@@ -36,7 +36,7 @@ class DataJdbcPostgreSQLApplicationAotTests {
void findById(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findById(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -44,7 +44,7 @@ class DataJdbcPostgreSQLApplicationAotTests {
void queryDerivedFromMethodName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findByPartialName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -52,7 +52,7 @@ class DataJdbcPostgreSQLApplicationAotTests {
void queryAnnotatedMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("queryFindByName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
});
}
diff --git a/data/data-jpa-kotlin/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java b/data/data-jpa-kotlin/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java
index ad45e31f..d3988df6 100644
--- a/data/data-jpa-kotlin/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java
+++ b/data/data-jpa-kotlin/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java
@@ -17,9 +17,9 @@ class DataJpaApplicationAotTests {
void insert(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("insertAuthors(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}")
- .hasSingleLineContaining("Persisted Author{name='Josh Long'}")
- .hasSingleLineContaining("Persisted Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}")
+ .hasSingleLineContaining("Persisted Author{name='Josh Long'}")
+ .hasSingleLineContaining("Persisted Author{name='Martin Kleppmann'}");
});
}
@@ -27,10 +27,10 @@ class DataJpaApplicationAotTests {
void listAllAuthors(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("listAllAuthors(): author = Author{name='Josh Long'")
- .hasSingleLineContaining("Book{title='Cloud Native Java'}")
- .hasSingleLineContaining("Book{title='Reactive Spring'}")
- .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
- .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'}");
+ .hasSingleLineContaining("Book{title='Cloud Native Java'}")
+ .hasSingleLineContaining("Book{title='Reactive Spring'}")
+ .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
+ .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'}");
});
}
@@ -38,7 +38,7 @@ class DataJpaApplicationAotTests {
void findById(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findById(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -46,7 +46,7 @@ class DataJpaApplicationAotTests {
void queryDerivedFromMethodName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findByPartialName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -54,7 +54,7 @@ class DataJpaApplicationAotTests {
void queryAnnotatedMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("queryFindByName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
});
}
diff --git a/data/data-jpa/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java b/data/data-jpa/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java
index de0abefb..239a2dd3 100644
--- a/data/data-jpa/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java
+++ b/data/data-jpa/src/appTest/java/com/example/data/jpa/DataJpaApplicationAotTests.java
@@ -17,7 +17,7 @@ class DataJpaApplicationAotTests {
void insert(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("insertAuthors(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("insertAuthors(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -25,10 +25,10 @@ class DataJpaApplicationAotTests {
void listAllAuthors(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("listAllAuthors(): author = Author{name='Josh Long'")
- .hasSingleLineContaining("Book{title='Cloud Native Java'")
- .hasSingleLineContaining("Book{title='Reactive Spring'")
- .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
- .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'");
+ .hasSingleLineContaining("Book{title='Cloud Native Java'")
+ .hasSingleLineContaining("Book{title='Reactive Spring'")
+ .hasSingleLineContaining("listAllAuthors(): author = Author{name='Martin Kleppmann'}")
+ .hasSingleLineContaining("Book{title='Designing Data Intensive Applications'");
});
}
@@ -36,7 +36,7 @@ class DataJpaApplicationAotTests {
void findById(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findById(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findById(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -44,7 +44,7 @@ class DataJpaApplicationAotTests {
void queryDerivedFromMethodName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findByPartialName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("findByPartialName(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -52,7 +52,7 @@ class DataJpaApplicationAotTests {
void queryAnnotatedMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("queryFindByName(): author1 = Author{name='Josh Long'}")
- .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
+ .hasSingleLineContaining("queryFindByName(): author2 = Author{name='Martin Kleppmann'}");
});
}
@@ -74,9 +74,9 @@ class DataJpaApplicationAotTests {
void entityGraph(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasLineContaining("left join (book_authors a1_0 join author a1_1 on a1_1.id=a1_0.authors_id)")
- .hasSingleLineContaining(
- "namedEntityGraph: Book{title='Spring in Action', authors=[Author{name='Craig Walls'}]}");
+ .hasLineContaining("left join (book_authors a1_0 join author a1_1 on a1_1.id=a1_0.authors_id)")
+ .hasSingleLineContaining(
+ "namedEntityGraph: Book{title='Spring in Action', authors=[Author{name='Craig Walls'}]}");
});
}
diff --git a/data/data-mongodb-reactive/src/appTest/java/com/example/data/mongodb/reactive/DataMongoDbReactiveApplicationAotTests.java b/data/data-mongodb-reactive/src/appTest/java/com/example/data/mongodb/reactive/DataMongoDbReactiveApplicationAotTests.java
index abb2a1a1..7007c442 100644
--- a/data/data-mongodb-reactive/src/appTest/java/com/example/data/mongodb/reactive/DataMongoDbReactiveApplicationAotTests.java
+++ b/data/data-mongodb-reactive/src/appTest/java/com/example/data/mongodb/reactive/DataMongoDbReactiveApplicationAotTests.java
@@ -74,8 +74,8 @@ class DataMongoDbReactiveApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findAll(): Person{firstname='first-1', lastname='last-1'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
+ .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
});
}
@@ -83,7 +83,7 @@ class DataMongoDbReactiveApplicationAotTests {
void findByLastName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
});
}
diff --git a/data/data-mongodb/src/appTest/java/com/example/data/mongodb/DataMongoDbApplicationAotTests.java b/data/data-mongodb/src/appTest/java/com/example/data/mongodb/DataMongoDbApplicationAotTests.java
index d8687459..198c887b 100644
--- a/data/data-mongodb/src/appTest/java/com/example/data/mongodb/DataMongoDbApplicationAotTests.java
+++ b/data/data-mongodb/src/appTest/java/com/example/data/mongodb/DataMongoDbApplicationAotTests.java
@@ -41,9 +41,9 @@ class DataMongoDbApplicationAotTests {
void documentReference(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("document ref (no proxy): 30.0")
- .hasLineMatching("lazy document ref .*\\$LazyLoadingProxy")
- .hasLineContaining("lazy document ref (resolved): 30.0")
- .hasLineContaining("lazy document ref (resolved): 30.0");
+ .hasLineMatching("lazy document ref .*\\$LazyLoadingProxy")
+ .hasLineContaining("lazy document ref (resolved): 30.0")
+ .hasLineContaining("lazy document ref (resolved): 30.0");
});
}
@@ -58,8 +58,8 @@ class DataMongoDbApplicationAotTests {
void transactionSupport(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("in-transaction: Order{id='")
- .hasSingleLineContaining("transactional-status: rollback")
- .hasSingleLineContaining("after-transaction: []");
+ .hasSingleLineContaining("transactional-status: rollback")
+ .hasSingleLineContaining("after-transaction: []");
});
}
@@ -67,8 +67,8 @@ class DataMongoDbApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findAll(): Person{firstname='first-1', lastname='last-1'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
+ .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
});
}
@@ -76,7 +76,7 @@ class DataMongoDbApplicationAotTests {
void findByLastName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
});
}
diff --git a/data/data-r2dbc/src/appTest/java/com/example/data/r2dbc/DataR2dbcApplicationAotTests.java b/data/data-r2dbc/src/appTest/java/com/example/data/r2dbc/DataR2dbcApplicationAotTests.java
index b826f511..261cc23e 100644
--- a/data/data-r2dbc/src/appTest/java/com/example/data/r2dbc/DataR2dbcApplicationAotTests.java
+++ b/data/data-r2dbc/src/appTest/java/com/example/data/r2dbc/DataR2dbcApplicationAotTests.java
@@ -17,7 +17,7 @@ class DataR2dbcApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findAll(): Reservation{id=1, name='reservation-1'}")
- .hasSingleLineContaining("findAll(): Reservation{id=2, name='reservation-2'}");
+ .hasSingleLineContaining("findAll(): Reservation{id=2, name='reservation-2'}");
});
}
diff --git a/data/data-redis-reactive/src/appTest/java/com/example/data/redis/reactive/DataRedisReactiveApplicationAotTests.java b/data/data-redis-reactive/src/appTest/java/com/example/data/redis/reactive/DataRedisReactiveApplicationAotTests.java
index dad7e175..9d263e47 100644
--- a/data/data-redis-reactive/src/appTest/java/com/example/data/redis/reactive/DataRedisReactiveApplicationAotTests.java
+++ b/data/data-redis-reactive/src/appTest/java/com/example/data/redis/reactive/DataRedisReactiveApplicationAotTests.java
@@ -31,8 +31,8 @@ class DataRedisReactiveApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("1: Person{firstname='first-1', lastname='last-1'}")
- .hasSingleLineContaining("2: Person{firstname='first-2', lastname='last-2'}")
- .hasSingleLineContaining("3: Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("2: Person{firstname='first-2', lastname='last-2'}")
+ .hasSingleLineContaining("3: Person{firstname='first-3', lastname='last-3'}");
});
}
diff --git a/data/data-redis/src/appTest/java/com/example/data/redis/DataRedisApplicationAotTests.java b/data/data-redis/src/appTest/java/com/example/data/redis/DataRedisApplicationAotTests.java
index 13796b4e..40b62561 100644
--- a/data/data-redis/src/appTest/java/com/example/data/redis/DataRedisApplicationAotTests.java
+++ b/data/data-redis/src/appTest/java/com/example/data/redis/DataRedisApplicationAotTests.java
@@ -43,8 +43,8 @@ class DataRedisApplicationAotTests {
@Test
void jsonSerializer(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
- assertThat(output).hasSingleLineContaining(
- "json-serializer: Person{firstname='json-serialized-1', lastname='value'}");
+ assertThat(output)
+ .hasSingleLineContaining("json-serializer: Person{firstname='json-serialized-1', lastname='value'}");
});
}
@@ -59,8 +59,8 @@ class DataRedisApplicationAotTests {
void findAll(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("findAll(): Person{firstname='first-1', lastname='last-1'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
- .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findAll(): Person{firstname='first-2', lastname='last-2'}")
+ .hasSingleLineContaining("findAll(): Person{firstname='first-3', lastname='last-3'}");
});
}
@@ -68,7 +68,7 @@ class DataRedisApplicationAotTests {
void findByLastName(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
+ .hasSingleLineContaining("findByLastname(): Person{firstname='first-3', lastname='last-3'}");
});
}
diff --git a/data/data-rest-mongodb/src/appTest/java/com/example/data/rest/mongodb/DataRestMongoDbApplicationAotTests.java b/data/data-rest-mongodb/src/appTest/java/com/example/data/rest/mongodb/DataRestMongoDbApplicationAotTests.java
index 84fc8e3c..21b171a9 100644
--- a/data/data-rest-mongodb/src/appTest/java/com/example/data/rest/mongodb/DataRestMongoDbApplicationAotTests.java
+++ b/data/data-rest-mongodb/src/appTest/java/com/example/data/rest/mongodb/DataRestMongoDbApplicationAotTests.java
@@ -20,40 +20,61 @@ class DataRestMongoDbApplicationAotTests {
void indexHasLinks(WebTestClient client) {
client.get().uri("/").exchange().expectBody().jsonPath("$._links.persons.href").value((href) -> {
assertThat(href).asInstanceOf(InstanceOfAssertFactories.STRING)
- .matches(Pattern.compile("http://localhost:\\d+/person\\{\\?page,size,sort}"));
+ .matches(Pattern.compile("http://localhost:\\d+/person\\{\\?page,size,sort}"));
}).jsonPath("$._links.profile.href").value((href) -> {
assertThat(href).asInstanceOf(InstanceOfAssertFactories.STRING)
- .matches(Pattern.compile("http://localhost:\\d+/profile"));
+ .matches(Pattern.compile("http://localhost:\\d+/profile"));
});
}
@Test
void shouldReturnAllPersons(WebTestClient client) {
- client.get().uri("/person?sort=firstname,asc").exchange().expectBody()
- .jsonPath("$._embedded.persons[0].firstname").isEqualTo("first-1")
- .jsonPath("$._embedded.persons[0].lastname").isEqualTo("last-1")
- .jsonPath("$._embedded.persons[1].firstname").isEqualTo("first-2")
- .jsonPath("$._embedded.persons[1].lastname").isEqualTo("last-2")
- .jsonPath("$._embedded.persons[2].firstname").isEqualTo("first-3")
- .jsonPath("$._embedded.persons[2].lastname").isEqualTo("last-3");
+ client.get()
+ .uri("/person?sort=firstname,asc")
+ .exchange()
+ .expectBody()
+ .jsonPath("$._embedded.persons[0].firstname")
+ .isEqualTo("first-1")
+ .jsonPath("$._embedded.persons[0].lastname")
+ .isEqualTo("last-1")
+ .jsonPath("$._embedded.persons[1].firstname")
+ .isEqualTo("first-2")
+ .jsonPath("$._embedded.persons[1].lastname")
+ .isEqualTo("last-2")
+ .jsonPath("$._embedded.persons[2].firstname")
+ .isEqualTo("first-3")
+ .jsonPath("$._embedded.persons[2].lastname")
+ .isEqualTo("last-3");
}
@Test
void shouldCreateNewPerson(WebTestClient client) {
- FluxExchangeResult result = client.post().uri("/person").contentType(MediaType.APPLICATION_JSON)
- .bodyValue("""
- {
- "firstname": "test-first-1",
- "lastname": "test-last-1"
- }
- """).exchange().expectStatus().isCreated().returnResult(String.class);
+ FluxExchangeResult result = client.post()
+ .uri("/person")
+ .contentType(MediaType.APPLICATION_JSON)
+ .bodyValue("""
+ {
+ "firstname": "test-first-1",
+ "lastname": "test-last-1"
+ }
+ """)
+ .exchange()
+ .expectStatus()
+ .isCreated()
+ .returnResult(String.class);
result.getResponseBody().ignoreElements().block();
URI location = result.getResponseHeaders().getLocation();
assertThat(location).isNotNull();
- client.get().uri(location).exchange().expectBody().jsonPath("$.firstname").isEqualTo("test-first-1")
- .jsonPath("$.lastname").isEqualTo("test-last-1");
+ client.get()
+ .uri(location)
+ .exchange()
+ .expectBody()
+ .jsonPath("$.firstname")
+ .isEqualTo("test-first-1")
+ .jsonPath("$.lastname")
+ .isEqualTo("test-last-1");
}
}
diff --git a/data/hateoas/src/appTest/java/com/example/hateoas/HateoasApplicationAotTests.java b/data/hateoas/src/appTest/java/com/example/hateoas/HateoasApplicationAotTests.java
index 208ce1a7..624bd852 100644
--- a/data/hateoas/src/appTest/java/com/example/hateoas/HateoasApplicationAotTests.java
+++ b/data/hateoas/src/appTest/java/com/example/hateoas/HateoasApplicationAotTests.java
@@ -28,37 +28,71 @@ class HateoasApplicationAotTests {
@Test
void employeeHasLinks(WebTestClient client) {
- client.get().uri("/employee/1").exchange().expectStatus().isOk().expectBody().jsonPath("$.id").isEqualTo("1")
- .jsonPath("$._links.self.href").value(v -> {
- assertThat(v).isInstanceOf(String.class);
- assertThat((String) v).endsWith("/employee/1");
- }).jsonPath("$._links.manager.href").value(v -> {
- assertThat(v).isInstanceOf(String.class);
- assertThat((String) v).endsWith("/manager/1");
- });
+ client.get()
+ .uri("/employee/1")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.id")
+ .isEqualTo("1")
+ .jsonPath("$._links.self.href")
+ .value(v -> {
+ assertThat(v).isInstanceOf(String.class);
+ assertThat((String) v).endsWith("/employee/1");
+ })
+ .jsonPath("$._links.manager.href")
+ .value(v -> {
+ assertThat(v).isInstanceOf(String.class);
+ assertThat((String) v).endsWith("/manager/1");
+ });
}
@Test
void managerHasLinks(WebTestClient client) {
- client.get().uri("/manager/1").exchange().expectStatus().isOk().expectBody().jsonPath("$.id").isEqualTo("1")
- .jsonPath("$._links.self.href").value(v -> {
- assertThat(v).isInstanceOf(String.class);
- assertThat((String) v).endsWith("/manager/1");
- }).jsonPath("$._links.reports.href").value(v -> {
- assertThat(v).isInstanceOf(String.class);
- assertThat((String) v).endsWith("/manager/1/reports");
- });
+ client.get()
+ .uri("/manager/1")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.id")
+ .isEqualTo("1")
+ .jsonPath("$._links.self.href")
+ .value(v -> {
+ assertThat(v).isInstanceOf(String.class);
+ assertThat((String) v).endsWith("/manager/1");
+ })
+ .jsonPath("$._links.reports.href")
+ .value(v -> {
+ assertThat(v).isInstanceOf(String.class);
+ assertThat((String) v).endsWith("/manager/1/reports");
+ });
}
@Test
void reportsIsCollection(WebTestClient client) {
- client.get().uri("/manager/1/reports").exchange().expectStatus().isOk().expectBody()
- .jsonPath("$._links.self.href").value(v -> {
- assertThat(v).isInstanceOf(String.class);
- assertThat((String) v).endsWith("/manager/1/reports");
- }).jsonPath("$._embedded").isMap().jsonPath("$._embedded.employees").isArray()
- .jsonPath("$._embedded.employees[0].id").isEqualTo("1").jsonPath("$._embedded.employees[1].id")
- .isEqualTo("2").jsonPath("$._embedded.employees[2].id").isEqualTo("3");
+ client.get()
+ .uri("/manager/1/reports")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$._links.self.href")
+ .value(v -> {
+ assertThat(v).isInstanceOf(String.class);
+ assertThat((String) v).endsWith("/manager/1/reports");
+ })
+ .jsonPath("$._embedded")
+ .isMap()
+ .jsonPath("$._embedded.employees")
+ .isArray()
+ .jsonPath("$._embedded.employees[0].id")
+ .isEqualTo("1")
+ .jsonPath("$._embedded.employees[1].id")
+ .isEqualTo("2")
+ .jsonPath("$._embedded.employees[2].id")
+ .isEqualTo("3");
}
}
diff --git a/framework/aspect/src/appTest/java/com/example/aspect/AspectApplicationAotTests.java b/framework/aspect/src/appTest/java/com/example/aspect/AspectApplicationAotTests.java
index 6b6d2b15..e6906bbe 100644
--- a/framework/aspect/src/appTest/java/com/example/aspect/AspectApplicationAotTests.java
+++ b/framework/aspect/src/appTest/java/com/example/aspect/AspectApplicationAotTests.java
@@ -15,8 +15,10 @@ class AspectApplicationAotTests {
@Test
void shouldInterceptMethodA(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> assertThat(output)
- .hasSingleLineContaining("methodA: A-from-aspect").hasSingleLineContaining("methodB: B"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("methodA: A-from-aspect")
+ .hasSingleLineContaining("methodB: B"));
}
}
diff --git a/framework/async/src/appTest/java/com/example/async/AsyncApplicationAotTests.java b/framework/async/src/appTest/java/com/example/async/AsyncApplicationAotTests.java
index 15f2b7b7..84e473a6 100644
--- a/framework/async/src/appTest/java/com/example/async/AsyncApplicationAotTests.java
+++ b/framework/async/src/appTest/java/com/example/async/AsyncApplicationAotTests.java
@@ -15,8 +15,9 @@ class AsyncApplicationAotTests {
@Test
void asyncShouldRunInTheBackground(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("set:Asynchronous action running..."));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("set:Asynchronous action running..."));
}
}
diff --git a/framework/cache-caffeine/src/appTest/java/com/example/cache/caffeine/CacheCaffeineApplicationAotTests.java b/framework/cache-caffeine/src/appTest/java/com/example/cache/caffeine/CacheCaffeineApplicationAotTests.java
index 970d21b9..d00304fe 100644
--- a/framework/cache-caffeine/src/appTest/java/com/example/cache/caffeine/CacheCaffeineApplicationAotTests.java
+++ b/framework/cache-caffeine/src/appTest/java/com/example/cache/caffeine/CacheCaffeineApplicationAotTests.java
@@ -24,7 +24,7 @@ class CacheCaffeineApplicationAotTests {
void methodIsCachedOnInterfaces(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("interface.invoke: 1")
- .hasNoLinesContaining("interface.invoke: 2");
+ .hasNoLinesContaining("interface.invoke: 2");
});
}
diff --git a/framework/configuration-class-proxy/src/appTest/java/com/example/configuration/ConfigurationClassProxyApplicationAotTests.java b/framework/configuration-class-proxy/src/appTest/java/com/example/configuration/ConfigurationClassProxyApplicationAotTests.java
index 52628cf9..823b4bc2 100644
--- a/framework/configuration-class-proxy/src/appTest/java/com/example/configuration/ConfigurationClassProxyApplicationAotTests.java
+++ b/framework/configuration-class-proxy/src/appTest/java/com/example/configuration/ConfigurationClassProxyApplicationAotTests.java
@@ -15,8 +15,10 @@ class ConfigurationClassProxyApplicationAotTests {
@Test
void expectedLoggingIsProduced(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> assertThat(output)
- .hasSingleLineContaining("Main: Hello0 World").hasSingleLineContaining("Nested: Nested Hello0 World"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Main: Hello0 World")
+ .hasSingleLineContaining("Nested: Nested Hello0 World"));
}
}
diff --git a/framework/event-listener/src/appTest/java/com/example/eventlistener/EventListenerApplicationAotTests.java b/framework/event-listener/src/appTest/java/com/example/eventlistener/EventListenerApplicationAotTests.java
index d4d9db80..16fc1e5c 100644
--- a/framework/event-listener/src/appTest/java/com/example/eventlistener/EventListenerApplicationAotTests.java
+++ b/framework/event-listener/src/appTest/java/com/example/eventlistener/EventListenerApplicationAotTests.java
@@ -18,7 +18,7 @@ class EventListenerApplicationAotTests {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("HelloEventPublisher: Publishing HelloEvent");
assertThat(output)
- .hasSingleLineContaining("HelloEventListener: Got event HelloEvent{greeting='Hello world'}");
+ .hasSingleLineContaining("HelloEventListener: Got event HelloEvent{greeting='Hello world'}");
});
}
diff --git a/framework/hibernate/src/appTest/java/com/example/spring/orm/HibernateApplicationAotTests.java b/framework/hibernate/src/appTest/java/com/example/spring/orm/HibernateApplicationAotTests.java
index a9bb9118..40a0d39b 100644
--- a/framework/hibernate/src/appTest/java/com/example/spring/orm/HibernateApplicationAotTests.java
+++ b/framework/hibernate/src/appTest/java/com/example/spring/orm/HibernateApplicationAotTests.java
@@ -17,9 +17,9 @@ class HibernateApplicationAotTests {
void entityGraph(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasLineContaining("left join (book_authors a1_0 join author a1_1 on a1_1.id=a1_0.authors_id)")
- .hasSingleLineContaining(
- "namedEntityGraph: Book{title='Spring in Action', authors=[Author{name='Craig Walls'}]}");
+ .hasLineContaining("left join (book_authors a1_0 join author a1_1 on a1_1.id=a1_0.authors_id)")
+ .hasSingleLineContaining(
+ "namedEntityGraph: Book{title='Spring in Action', authors=[Author{name='Craig Walls'}]}");
});
}
diff --git a/framework/jdbc-h2/src/appTest/java/com/example/jdbc/h2/JdbcH2ApplicationAotTests.java b/framework/jdbc-h2/src/appTest/java/com/example/jdbc/h2/JdbcH2ApplicationAotTests.java
index 1218a84c..3b2a5252 100644
--- a/framework/jdbc-h2/src/appTest/java/com/example/jdbc/h2/JdbcH2ApplicationAotTests.java
+++ b/framework/jdbc-h2/src/appTest/java/com/example/jdbc/h2/JdbcH2ApplicationAotTests.java
@@ -15,10 +15,11 @@ class JdbcH2ApplicationAotTests {
@Test
void authorsCanBeQueried(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(
- () -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
- .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
- .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
+ .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
+ .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
}
}
diff --git a/framework/jdbc-mariadb/src/appTest/java/com/example/jdbc/mariadb/JdbcMariaDBApplicationAotTests.java b/framework/jdbc-mariadb/src/appTest/java/com/example/jdbc/mariadb/JdbcMariaDBApplicationAotTests.java
index 372105bf..65ff1bd2 100644
--- a/framework/jdbc-mariadb/src/appTest/java/com/example/jdbc/mariadb/JdbcMariaDBApplicationAotTests.java
+++ b/framework/jdbc-mariadb/src/appTest/java/com/example/jdbc/mariadb/JdbcMariaDBApplicationAotTests.java
@@ -15,10 +15,11 @@ class JdbcMariaDBApplicationAotTests {
@Test
void authorsCanBeQueried(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(
- () -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
- .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
- .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
+ .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
+ .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
}
}
diff --git a/framework/jdbc-mysql/src/appTest/java/com/example/jdbc/mysql/JdbcMySQLApplicationAotTests.java b/framework/jdbc-mysql/src/appTest/java/com/example/jdbc/mysql/JdbcMySQLApplicationAotTests.java
index ba588ea3..663b45f8 100644
--- a/framework/jdbc-mysql/src/appTest/java/com/example/jdbc/mysql/JdbcMySQLApplicationAotTests.java
+++ b/framework/jdbc-mysql/src/appTest/java/com/example/jdbc/mysql/JdbcMySQLApplicationAotTests.java
@@ -15,10 +15,11 @@ class JdbcMySQLApplicationAotTests {
@Test
void authorsCanBeQueried(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(
- () -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
- .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
- .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
+ .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
+ .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
}
}
diff --git a/framework/jdbc-postgresql/src/appTest/java/com/example/jdbc/postgresql/JdbcPostgreSQLApplicationAotTests.java b/framework/jdbc-postgresql/src/appTest/java/com/example/jdbc/postgresql/JdbcPostgreSQLApplicationAotTests.java
index 478edd83..f4e57e58 100644
--- a/framework/jdbc-postgresql/src/appTest/java/com/example/jdbc/postgresql/JdbcPostgreSQLApplicationAotTests.java
+++ b/framework/jdbc-postgresql/src/appTest/java/com/example/jdbc/postgresql/JdbcPostgreSQLApplicationAotTests.java
@@ -15,10 +15,11 @@ class JdbcPostgreSQLApplicationAotTests {
@Test
void authorsCanBeQueried(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(
- () -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
- .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
- .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Found author: Author[id=1, name=mbhave]")
+ .hasSingleLineContaining("Found author: Author[id=2, name=snicoll]")
+ .hasSingleLineContaining("Found author: Author[id=3, name=wilkinsona]"));
}
}
diff --git a/framework/order/src/appTest/java/com/example/order/OrderApplicationAotTests.java b/framework/order/src/appTest/java/com/example/order/OrderApplicationAotTests.java
index 073fb59d..aac47805 100644
--- a/framework/order/src/appTest/java/com/example/order/OrderApplicationAotTests.java
+++ b/framework/order/src/appTest/java/com/example/order/OrderApplicationAotTests.java
@@ -15,8 +15,9 @@ class OrderApplicationAotTests {
@Test
void expectedOrderIsLogged(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(
- () -> assertThat(output).hasSingleLineContaining("Items: priority50, -20, -10, 10, none"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Items: priority50, -20, -10, 10, none"));
}
}
diff --git a/framework/rest-template/src/appTest/java/com/example/resttemplate/RestTemplateApplicationAotTests.java b/framework/rest-template/src/appTest/java/com/example/resttemplate/RestTemplateApplicationAotTests.java
index 1ddb076b..5bc1bc44 100644
--- a/framework/rest-template/src/appTest/java/com/example/resttemplate/RestTemplateApplicationAotTests.java
+++ b/framework/rest-template/src/appTest/java/com/example/resttemplate/RestTemplateApplicationAotTests.java
@@ -19,7 +19,7 @@ class RestTemplateApplicationAotTests {
void httpWorks(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("http: DataDto{url='http://httpbin.org/anything', method='GET'}");
+ .hasSingleLineContaining("http: DataDto{url='http://httpbin.org/anything', method='GET'}");
});
}
@@ -27,7 +27,7 @@ class RestTemplateApplicationAotTests {
void httpsWorks(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("https: DataDto{url='https://httpbin.org/anything', method='GET'}");
+ .hasSingleLineContaining("https: DataDto{url='https://httpbin.org/anything', method='GET'}");
});
}
diff --git a/framework/rsocket/src/appTest/java/com/example/rsocket/RSocketApplicationAotTests.java b/framework/rsocket/src/appTest/java/com/example/rsocket/RSocketApplicationAotTests.java
index 8b32ca7b..835ef655 100644
--- a/framework/rsocket/src/appTest/java/com/example/rsocket/RSocketApplicationAotTests.java
+++ b/framework/rsocket/src/appTest/java/com/example/rsocket/RSocketApplicationAotTests.java
@@ -17,7 +17,7 @@ class RSocketApplicationAotTests {
void messageIsReceivedAndAnswered(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("Server: message(): Message{origin='client', message='Hello!'}")
- .hasSingleLineContaining("Client: message(): Message{origin='server', message='Hello!'}");
+ .hasSingleLineContaining("Client: message(): Message{origin='server', message='Hello!'}");
});
}
@@ -25,8 +25,8 @@ class RSocketApplicationAotTests {
void reactiveMessageIsReceivedAndAnswered(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("Server: reactiveMessage: Message{origin='client', message='Hello!'}")
- .hasSingleLineContaining("Client: reactiveMessage(): Message{origin='server', message='Hello!'}");
+ .hasSingleLineContaining("Server: reactiveMessage: Message{origin='client', message='Hello!'}")
+ .hasSingleLineContaining("Client: reactiveMessage(): Message{origin='server', message='Hello!'}");
});
}
@@ -34,8 +34,8 @@ class RSocketApplicationAotTests {
void messageRecordIsReceivedAndAnswered(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("Server: messageRecord(): MessageRecord[origin=client, message=Hello!]")
- .hasSingleLineContaining("Client: messageRecord(): MessageRecord[origin=server, message=Hello!]");
+ .hasSingleLineContaining("Server: messageRecord(): MessageRecord[origin=client, message=Hello!]")
+ .hasSingleLineContaining("Client: messageRecord(): MessageRecord[origin=server, message=Hello!]");
});
}
@@ -43,7 +43,7 @@ class RSocketApplicationAotTests {
void messageExceptionHandler(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("Client: messageExceptionHandler()")
- .hasSingleLineContaining("Server: handleIllegalStateException()");
+ .hasSingleLineContaining("Server: handleIllegalStateException()");
});
}
diff --git a/framework/scheduled/src/appTest/java/com/example/scheduled/ScheduledApplicationAotTests.java b/framework/scheduled/src/appTest/java/com/example/scheduled/ScheduledApplicationAotTests.java
index fb9a6a3c..17808915 100644
--- a/framework/scheduled/src/appTest/java/com/example/scheduled/ScheduledApplicationAotTests.java
+++ b/framework/scheduled/src/appTest/java/com/example/scheduled/ScheduledApplicationAotTests.java
@@ -15,20 +15,23 @@ class ScheduledApplicationAotTests {
@Test
void fixedRateShouldBeCalled(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasLineContaining("fixedRate()"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasLineContaining("fixedRate()"));
}
@Test
void fixedDelayShouldBeCalled(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasLineContaining("fixedDelay()"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasLineContaining("fixedDelay()"));
}
@Test
void cronShouldBeCalled(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasLineContaining("cron()"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasLineContaining("cron()"));
}
}
diff --git a/framework/transactional-event-listener/src/appTest/java/com/example/transactional/eventlistener/TransactionalEventListenerApplicationAotTests.java b/framework/transactional-event-listener/src/appTest/java/com/example/transactional/eventlistener/TransactionalEventListenerApplicationAotTests.java
index f36a9a87..4ec22f5e 100644
--- a/framework/transactional-event-listener/src/appTest/java/com/example/transactional/eventlistener/TransactionalEventListenerApplicationAotTests.java
+++ b/framework/transactional-event-listener/src/appTest/java/com/example/transactional/eventlistener/TransactionalEventListenerApplicationAotTests.java
@@ -17,10 +17,10 @@ class TransactionalEventListenerApplicationAotTests {
void eventIsPublishedIfTransactionIsCommited(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining(
- "TransactionalEventPublisher: Publishing TransactionalEvent (transaction successful)")
- .hasSingleLineContaining(
- "TransactionalEventListener: Got event TransactionalEvent{greeting='TX successful'}");
+ .hasSingleLineContaining(
+ "TransactionalEventPublisher: Publishing TransactionalEvent (transaction successful)")
+ .hasSingleLineContaining(
+ "TransactionalEventListener: Got event TransactionalEvent{greeting='TX successful'}");
});
}
@@ -28,10 +28,9 @@ class TransactionalEventListenerApplicationAotTests {
void eventIsNotPublishedIfTransactionIsAborted(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining(
- "TransactionalEventPublisher: Publishing TransactionalEvent (transaction failed)")
- .hasNoLinesContaining(
- "TransactionalEventListener: Got event TransactionalEvent{greeting='TX failed'}");
+ .hasSingleLineContaining(
+ "TransactionalEventPublisher: Publishing TransactionalEvent (transaction failed)")
+ .hasNoLinesContaining("TransactionalEventListener: Got event TransactionalEvent{greeting='TX failed'}");
});
}
diff --git a/framework/transactional/src/appTest/java/com/example/transactional/TransactionalApplicationAotTests.java b/framework/transactional/src/appTest/java/com/example/transactional/TransactionalApplicationAotTests.java
index d19c020f..778169a2 100644
--- a/framework/transactional/src/appTest/java/com/example/transactional/TransactionalApplicationAotTests.java
+++ b/framework/transactional/src/appTest/java/com/example/transactional/TransactionalApplicationAotTests.java
@@ -15,8 +15,9 @@ class TransactionalApplicationAotTests {
@Test
void transactionShouldBeActive(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Transaction active: true"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Transaction active: true"));
}
}
diff --git a/framework/validation/src/appTest/java/com/example/validation/ValidationApplicationAotTests.java b/framework/validation/src/appTest/java/com/example/validation/ValidationApplicationAotTests.java
index c0f42435..bc123625 100644
--- a/framework/validation/src/appTest/java/com/example/validation/ValidationApplicationAotTests.java
+++ b/framework/validation/src/appTest/java/com/example/validation/ValidationApplicationAotTests.java
@@ -35,8 +35,8 @@ class ValidationApplicationAotTests {
void methodValidationWorks(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("this.someService.hello('world'): hello world")
- .hasSingleLineContaining("this.someService.hello(''): Got expected exception").hasNoLinesContaining(
- "this.someService.hello(''): Invocation worked, this should not have happened!");
+ .hasSingleLineContaining("this.someService.hello(''): Got expected exception")
+ .hasNoLinesContaining("this.someService.hello(''): Invocation worked, this should not have happened!");
});
}
@@ -47,11 +47,22 @@ class ValidationApplicationAotTests {
@Test
void controllerValidationWorks(WebTestClient client) {
- client.post().uri("/hello").contentType(MediaType.APPLICATION_JSON).bodyValue("{\"name\": \"world\"}")
- .exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello world"));
- client.post().uri("/hello").contentType(MediaType.APPLICATION_JSON).bodyValue("{\"name\": \"\"}").exchange()
- .expectStatus().isBadRequest();
+ client.post()
+ .uri("/hello")
+ .contentType(MediaType.APPLICATION_JSON)
+ .bodyValue("{\"name\": \"world\"}")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello world"));
+ client.post()
+ .uri("/hello")
+ .contentType(MediaType.APPLICATION_JSON)
+ .bodyValue("{\"name\": \"\"}")
+ .exchange()
+ .expectStatus()
+ .isBadRequest();
}
}
diff --git a/framework/webclient/src/appTest/java/com/example/webclient/WebClientApplicationAotTests.java b/framework/webclient/src/appTest/java/com/example/webclient/WebClientApplicationAotTests.java
index 9e7007dc..c19a6b28 100644
--- a/framework/webclient/src/appTest/java/com/example/webclient/WebClientApplicationAotTests.java
+++ b/framework/webclient/src/appTest/java/com/example/webclient/WebClientApplicationAotTests.java
@@ -19,7 +19,7 @@ class WebClientApplicationAotTests {
void httpWorks(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("http: DataDto{url='http://httpbin.org/anything', method='GET'}");
+ .hasSingleLineContaining("http: DataDto{url='http://httpbin.org/anything', method='GET'}");
});
}
@@ -27,15 +27,15 @@ class WebClientApplicationAotTests {
void httpsWorks(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("https: DataDto{url='https://httpbin.org/anything', method='GET'}");
+ .hasSingleLineContaining("https: DataDto{url='https://httpbin.org/anything', method='GET'}");
});
}
@Test
void serviceWorks(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
- assertThat(output).hasSingleLineContaining(
- "service: ExchangeDataDto{url='https://httpbin.org/anything', method='GET'}");
+ assertThat(output)
+ .hasSingleLineContaining("service: ExchangeDataDto{url='https://httpbin.org/anything', method='GET'}");
});
}
diff --git a/framework/webflux-jetty/src/appTest/java/com/example/webflux/jetty/WebfluxJettyApplicationAotTests.java b/framework/webflux-jetty/src/appTest/java/com/example/webflux/jetty/WebfluxJettyApplicationAotTests.java
index cc122dd5..063b59e0 100644
--- a/framework/webflux-jetty/src/appTest/java/com/example/webflux/jetty/WebfluxJettyApplicationAotTests.java
+++ b/framework/webflux-jetty/src/appTest/java/com/example/webflux/jetty/WebfluxJettyApplicationAotTests.java
@@ -23,26 +23,45 @@ class WebfluxJettyApplicationAotTests {
@Test
void stringResponseBody(WebTestClient client) {
- client.get().exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hi!"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hi!"));
}
@Test
void anotherStringResponseBody(WebTestClient client) {
- client.get().uri("x").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hix!"));
+ client.get()
+ .uri("x")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hix!"));
}
@Test
void stringMonoResponseBody(WebTestClient client) {
- client.get().uri("hello").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("World"));
+ client.get()
+ .uri("hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("World"));
}
@Test
void jsonResponseFromSerializedRecordMono(WebTestClient client) {
- client.get().uri("record").exchange().expectStatus().isOk().expectBody()
- .json("{\"field1\":\"Hello\", \"field2\":\"World\"}");
+ client.get()
+ .uri("record")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"field1\":\"Hello\", \"field2\":\"World\"}");
}
@Test
@@ -77,9 +96,15 @@ class WebfluxJettyApplicationAotTests {
@Test
void xmlWorks(WebTestClient client) {
- client.post().uri("/xml").contentType(MediaType.APPLICATION_XML)
- .bodyValue("Hello").exchange().expectStatus().isOk().expectBody()
- .xml("Server: Hello");
+ client.post()
+ .uri("/xml")
+ .contentType(MediaType.APPLICATION_XML)
+ .bodyValue("Hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .xml("Server: Hello");
}
@Test
@@ -92,9 +117,14 @@ class WebfluxJettyApplicationAotTests {
// reactive
// pipeline
AtomicReference> messages = new AtomicReference<>();
- client.execute(URI.create(applicationUrl.resolve("/ws/count").toString()), session -> session.receive()
- .map(WebSocketMessage::getPayloadAsText).collectList().doOnNext(messages::set).then())
- .block(Duration.ofSeconds(10));
+ client
+ .execute(URI.create(applicationUrl.resolve("/ws/count").toString()),
+ session -> session.receive()
+ .map(WebSocketMessage::getPayloadAsText)
+ .collectList()
+ .doOnNext(messages::set)
+ .then())
+ .block(Duration.ofSeconds(10));
assertThat(messages.get()).isNotNull().containsExactly("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
}
finally {
diff --git a/framework/webflux-netty-tls/src/appTest/java/com/example/webflux/tls/WebFluxNettyTlsApplicationAotTests.java b/framework/webflux-netty-tls/src/appTest/java/com/example/webflux/tls/WebFluxNettyTlsApplicationAotTests.java
index b04526a9..107016ef 100644
--- a/framework/webflux-netty-tls/src/appTest/java/com/example/webflux/tls/WebFluxNettyTlsApplicationAotTests.java
+++ b/framework/webflux-netty-tls/src/appTest/java/com/example/webflux/tls/WebFluxNettyTlsApplicationAotTests.java
@@ -33,8 +33,13 @@ class WebFluxNettyTlsApplicationAotTests {
void stringResponseBody(@ApplicationUrl(scheme = Scheme.HTTPS) URI applicationUrl) throws Exception {
WebTestClient client = buildWebClient(applicationUrl);
- client.get().exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
}
@Test
@@ -44,9 +49,14 @@ class WebFluxNettyTlsApplicationAotTests {
// We can't use StepVerifier here, as it isn't designed to be used in a reactive
// pipeline
AtomicReference> messages = new AtomicReference<>();
- client.execute(URI.create(applicationUrl.resolve("/ws/count").toString()), session -> session.receive()
- .map(WebSocketMessage::getPayloadAsText).collectList().doOnNext(messages::set).then())
- .block(Duration.ofSeconds(10));
+ client
+ .execute(URI.create(applicationUrl.resolve("/ws/count").toString()),
+ session -> session.receive()
+ .map(WebSocketMessage::getPayloadAsText)
+ .collectList()
+ .doOnNext(messages::set)
+ .then())
+ .block(Duration.ofSeconds(10));
assertThat(messages.get()).isNotNull().containsExactly("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
}
@@ -76,7 +86,7 @@ class WebFluxNettyTlsApplicationAotTests {
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory
- .getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ .getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(trustStore);
SslContext sslContext = SslContextBuilder.forClient().trustManager(trustManagerFactory).build();
diff --git a/framework/webflux-netty/src/appTest/java/com/example/webflux/WebfluxApplicationAotTests.java b/framework/webflux-netty/src/appTest/java/com/example/webflux/WebfluxApplicationAotTests.java
index c45e5e8f..c350a536 100644
--- a/framework/webflux-netty/src/appTest/java/com/example/webflux/WebfluxApplicationAotTests.java
+++ b/framework/webflux-netty/src/appTest/java/com/example/webflux/WebfluxApplicationAotTests.java
@@ -23,26 +23,45 @@ class WebfluxApplicationAotTests {
@Test
void stringResponseBody(WebTestClient client) {
- client.get().exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hi!"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hi!"));
}
@Test
void anotherStringResponseBody(WebTestClient client) {
- client.get().uri("x").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hix!"));
+ client.get()
+ .uri("x")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hix!"));
}
@Test
void stringMonoResponseBody(WebTestClient client) {
- client.get().uri("hello").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("World"));
+ client.get()
+ .uri("hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("World"));
}
@Test
void jsonResponseFromSerializedRecordMono(WebTestClient client) {
- client.get().uri("record").exchange().expectStatus().isOk().expectBody()
- .json("{\"field1\":\"Hello\", \"field2\":\"World\"}");
+ client.get()
+ .uri("record")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"field1\":\"Hello\", \"field2\":\"World\"}");
}
@Test
@@ -81,17 +100,28 @@ class WebfluxApplicationAotTests {
// We can't use StepVerifier here, as it isn't designed to be used in a reactive
// pipeline
AtomicReference> messages = new AtomicReference<>();
- client.execute(URI.create(applicationUrl.resolve("/ws/count").toString()), session -> session.receive()
- .map(WebSocketMessage::getPayloadAsText).collectList().doOnNext(messages::set).then())
- .block(Duration.ofSeconds(10));
+ client
+ .execute(URI.create(applicationUrl.resolve("/ws/count").toString()),
+ session -> session.receive()
+ .map(WebSocketMessage::getPayloadAsText)
+ .collectList()
+ .doOnNext(messages::set)
+ .then())
+ .block(Duration.ofSeconds(10));
assertThat(messages.get()).isNotNull().containsExactly("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
}
@Test
void xmlWorks(WebTestClient client) {
- client.post().uri("/xml").contentType(MediaType.APPLICATION_XML)
- .bodyValue("Hello").exchange().expectStatus().isOk().expectBody()
- .xml("Server: Hello");
+ client.post()
+ .uri("/xml")
+ .contentType(MediaType.APPLICATION_XML)
+ .bodyValue("Hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .xml("Server: Hello");
}
}
diff --git a/framework/webflux-undertow/src/appTest/java/com/example/webflux/undertow/WebfluxUndertowApplicationAotTests.java b/framework/webflux-undertow/src/appTest/java/com/example/webflux/undertow/WebfluxUndertowApplicationAotTests.java
index 1d96e442..fc3bf889 100644
--- a/framework/webflux-undertow/src/appTest/java/com/example/webflux/undertow/WebfluxUndertowApplicationAotTests.java
+++ b/framework/webflux-undertow/src/appTest/java/com/example/webflux/undertow/WebfluxUndertowApplicationAotTests.java
@@ -23,26 +23,45 @@ class WebfluxUndertowApplicationAotTests {
@Test
void stringResponseBody(WebTestClient client) {
- client.get().exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hi!"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hi!"));
}
@Test
void anotherStringResponseBody(WebTestClient client) {
- client.get().uri("x").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hix!"));
+ client.get()
+ .uri("x")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hix!"));
}
@Test
void stringMonoResponseBody(WebTestClient client) {
- client.get().uri("hello").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("World"));
+ client.get()
+ .uri("hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("World"));
}
@Test
void jsonResponseFromSerializedRecordMono(WebTestClient client) {
- client.get().uri("record").exchange().expectStatus().isOk().expectBody()
- .json("{\"field1\":\"Hello\", \"field2\":\"World\"}");
+ client.get()
+ .uri("record")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"field1\":\"Hello\", \"field2\":\"World\"}");
}
@Test
@@ -77,9 +96,15 @@ class WebfluxUndertowApplicationAotTests {
@Test
void xmlWorks(WebTestClient client) {
- client.post().uri("/xml").contentType(MediaType.APPLICATION_XML)
- .bodyValue("Hello").exchange().expectStatus().isOk().expectBody()
- .xml("Server: Hello");
+ client.post()
+ .uri("/xml")
+ .contentType(MediaType.APPLICATION_XML)
+ .bodyValue("Hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .xml("Server: Hello");
}
@Test
@@ -91,9 +116,14 @@ class WebfluxUndertowApplicationAotTests {
// We can't use StepVerifier here, as it isn't designed to be used in a
// reactive pipeline
AtomicReference> messages = new AtomicReference<>();
- client.execute(URI.create(applicationUrl.resolve("/ws/count").toString()), session -> session.receive()
- .map(WebSocketMessage::getPayloadAsText).collectList().doOnNext(messages::set).then())
- .block(Duration.ofSeconds(10));
+ client
+ .execute(URI.create(applicationUrl.resolve("/ws/count").toString()),
+ session -> session.receive()
+ .map(WebSocketMessage::getPayloadAsText)
+ .collectList()
+ .doOnNext(messages::set)
+ .then())
+ .block(Duration.ofSeconds(10));
assertThat(messages.get()).isNotNull().containsExactly("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
}
finally {
diff --git a/framework/webmvc-jetty-tls/src/appTest/java/com/example/webmvc/jetty/tls/WebMvcJettyTlsApplicationAotTests.java b/framework/webmvc-jetty-tls/src/appTest/java/com/example/webmvc/jetty/tls/WebMvcJettyTlsApplicationAotTests.java
index da1f979d..cbd3d855 100644
--- a/framework/webmvc-jetty-tls/src/appTest/java/com/example/webmvc/jetty/tls/WebMvcJettyTlsApplicationAotTests.java
+++ b/framework/webmvc-jetty-tls/src/appTest/java/com/example/webmvc/jetty/tls/WebMvcJettyTlsApplicationAotTests.java
@@ -42,8 +42,13 @@ class WebMvcJettyTlsApplicationAotTests {
void stringResponseBody(@ApplicationUrl(scheme = Scheme.HTTPS) URI applicationUrl) throws Exception {
WebTestClient client = buildWebClient(applicationUrl);
- client.get().exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
}
/**
@@ -61,7 +66,7 @@ class WebMvcJettyTlsApplicationAotTests {
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory
- .getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ .getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(trustStore);
SSLContext sslContext = SSLContext.getInstance("TLS");
diff --git a/framework/webmvc-jetty/src/appTest/java/com/example/webmvc/jetty/WebMvcJettyApplicationAotTests.java b/framework/webmvc-jetty/src/appTest/java/com/example/webmvc/jetty/WebMvcJettyApplicationAotTests.java
index aa9c22ab..efbba681 100644
--- a/framework/webmvc-jetty/src/appTest/java/com/example/webmvc/jetty/WebMvcJettyApplicationAotTests.java
+++ b/framework/webmvc-jetty/src/appTest/java/com/example/webmvc/jetty/WebMvcJettyApplicationAotTests.java
@@ -33,34 +33,59 @@ class WebMvcJettyApplicationAotTests {
@Test
void stringResponseBody(WebTestClient client) {
- client.get().exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("Hello from Spring MVC and Jetty"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .isEqualTo("Hello from Spring MVC and Jetty"));
}
@Test
void resourceInPublic(WebTestClient client) {
- client.get().uri("bar.html").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Bar"));
+ client.get()
+ .uri("bar.html")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Bar"));
}
@Test
void resourceInStatic(WebTestClient client) {
- client.get().uri("foo.html").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Foo"));
+ client.get()
+ .uri("foo.html")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Foo"));
}
@Test
void jsonResponseFromSerializedRecord(WebTestClient client) {
- client.get().uri("record").exchange().expectStatus().isOk().expectBody()
- .json("{\"message\":\"Hello from Spring MVC and Jetty\"}");
+ client.get()
+ .uri("record")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"message\":\"Hello from Spring MVC and Jetty\"}");
}
@Test
void sendPostToPostMappingDefinedOnAnInterfaceAndReceiveEchoedJsonResponse(WebTestClient client) {
- client.post().uri("echo").bodyValue("{\"message\": \"Native\"}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).exchange().expectStatus().isOk()
- .expectBody().json("{\"message\":\"Native\"}");
+ client.post()
+ .uri("echo")
+ .bodyValue("{\"message\": \"Native\"}")
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"message\":\"Native\"}");
}
@Test
@@ -73,13 +98,20 @@ class WebMvcJettyApplicationAotTests {
MultiValueMap formData = new LinkedMultiValueMap<>();
formData.add("firstName", "first-name");
formData.add("lastName", "last-name");
- client.post().uri("/form-submission").contentType(MediaType.MULTIPART_FORM_DATA)
- .body(BodyInserters.fromMultipartData(formData)).exchange().expectStatus().isOk().expectBody().json("""
- {
- "firstName": "first-name",
- "lastName": "last-name"
- }
- """);
+ client.post()
+ .uri("/form-submission")
+ .contentType(MediaType.MULTIPART_FORM_DATA)
+ .body(BodyInserters.fromMultipartData(formData))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("""
+ {
+ "firstName": "first-name",
+ "lastName": "last-name"
+ }
+ """);
}
@Test
@@ -99,9 +131,15 @@ class WebMvcJettyApplicationAotTests {
@Test
void xmlWorks(WebTestClient client) {
- client.post().uri("/xml").contentType(MediaType.APPLICATION_XML)
- .bodyValue("Hello").exchange().expectStatus().isOk().expectBody()
- .xml("Server: Hello");
+ client.post()
+ .uri("/xml")
+ .contentType(MediaType.APPLICATION_XML)
+ .bodyValue("Hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .xml("Server: Hello");
}
}
diff --git a/framework/webmvc-tomcat-tls/src/appTest/java/com/example/webmvc/tls/WebMvcTomcatTlsApplicationAotTests.java b/framework/webmvc-tomcat-tls/src/appTest/java/com/example/webmvc/tls/WebMvcTomcatTlsApplicationAotTests.java
index 535b3e11..c18b3345 100644
--- a/framework/webmvc-tomcat-tls/src/appTest/java/com/example/webmvc/tls/WebMvcTomcatTlsApplicationAotTests.java
+++ b/framework/webmvc-tomcat-tls/src/appTest/java/com/example/webmvc/tls/WebMvcTomcatTlsApplicationAotTests.java
@@ -42,8 +42,13 @@ class WebMvcTomcatTlsApplicationAotTests {
void stringResponseBody(@ApplicationUrl(scheme = Scheme.HTTPS) URI applicationUrl) throws Exception {
WebTestClient client = buildWebClient(applicationUrl);
- client.get().exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
}
/**
@@ -61,7 +66,7 @@ class WebMvcTomcatTlsApplicationAotTests {
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory
- .getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ .getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(trustStore);
SSLContext sslContext = SSLContext.getInstance("TLS");
diff --git a/framework/webmvc-tomcat/src/appTest/java/com/example/webmvc/WebMvcApplicationAotTests.java b/framework/webmvc-tomcat/src/appTest/java/com/example/webmvc/WebMvcApplicationAotTests.java
index d3feb723..ae938ab9 100644
--- a/framework/webmvc-tomcat/src/appTest/java/com/example/webmvc/WebMvcApplicationAotTests.java
+++ b/framework/webmvc-tomcat/src/appTest/java/com/example/webmvc/WebMvcApplicationAotTests.java
@@ -33,34 +33,59 @@ class WebMvcApplicationAotTests {
@Test
void stringResponseBody(WebTestClient client) {
- client.get().exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("Hello from Spring MVC and Tomcat"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .isEqualTo("Hello from Spring MVC and Tomcat"));
}
@Test
void resourceInPublic(WebTestClient client) {
- client.get().uri("bar.html").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Bar"));
+ client.get()
+ .uri("bar.html")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Bar"));
}
@Test
void resourceInStatic(WebTestClient client) {
- client.get().uri("foo.html").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Foo"));
+ client.get()
+ .uri("foo.html")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Foo"));
}
@Test
void jsonResponseFromSerializedRecord(WebTestClient client) {
- client.get().uri("record").exchange().expectStatus().isOk().expectBody()
- .json("{\"message\":\"Hello from Spring MVC and Tomcat\"}");
+ client.get()
+ .uri("record")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"message\":\"Hello from Spring MVC and Tomcat\"}");
}
@Test
void sendPostToPostMappingDefinedOnAnInterfaceAndReceiveEchoedJsonResponse(WebTestClient client) {
- client.post().uri("echo").bodyValue("{\"message\": \"Native\"}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).exchange().expectStatus().isOk()
- .expectBody().json("{\"message\":\"Native\"}");
+ client.post()
+ .uri("echo")
+ .bodyValue("{\"message\": \"Native\"}")
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"message\":\"Native\"}");
}
@Test
@@ -73,13 +98,20 @@ class WebMvcApplicationAotTests {
MultiValueMap formData = new LinkedMultiValueMap<>();
formData.add("firstName", "first-name");
formData.add("lastName", "last-name");
- client.post().uri("/form-submission").contentType(MediaType.MULTIPART_FORM_DATA)
- .body(BodyInserters.fromMultipartData(formData)).exchange().expectStatus().isOk().expectBody().json("""
- {
- "firstName": "first-name",
- "lastName": "last-name"
- }
- """);
+ client.post()
+ .uri("/form-submission")
+ .contentType(MediaType.MULTIPART_FORM_DATA)
+ .body(BodyInserters.fromMultipartData(formData))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("""
+ {
+ "firstName": "first-name",
+ "lastName": "last-name"
+ }
+ """);
}
@Test
@@ -99,9 +131,15 @@ class WebMvcApplicationAotTests {
@Test
void xmlWorks(WebTestClient client) {
- client.post().uri("/xml").contentType(MediaType.APPLICATION_XML)
- .bodyValue("Hello").exchange().expectStatus().isOk().expectBody()
- .xml("Server: Hello");
+ client.post()
+ .uri("/xml")
+ .contentType(MediaType.APPLICATION_XML)
+ .bodyValue("Hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .xml("Server: Hello");
}
}
diff --git a/framework/webmvc-undertow-tls/src/appTest/java/com/example/webmvc/undertow/tls/WebMvcUndertowTlsApplicationAotTests.java b/framework/webmvc-undertow-tls/src/appTest/java/com/example/webmvc/undertow/tls/WebMvcUndertowTlsApplicationAotTests.java
index 7cb6f115..b794a81a 100644
--- a/framework/webmvc-undertow-tls/src/appTest/java/com/example/webmvc/undertow/tls/WebMvcUndertowTlsApplicationAotTests.java
+++ b/framework/webmvc-undertow-tls/src/appTest/java/com/example/webmvc/undertow/tls/WebMvcUndertowTlsApplicationAotTests.java
@@ -42,8 +42,13 @@ class WebMvcUndertowTlsApplicationAotTests {
void stringResponseBody(@ApplicationUrl(scheme = Scheme.HTTPS) URI applicationUrl) throws Exception {
WebTestClient client = buildWebClient(applicationUrl);
- client.get().exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello World TLS"));
}
/**
@@ -61,7 +66,7 @@ class WebMvcUndertowTlsApplicationAotTests {
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory
- .getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ .getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(trustStore);
SSLContext sslContext = SSLContext.getInstance("TLS");
diff --git a/framework/webmvc-undertow/src/appTest/java/com/example/webmvc/undertow/WebMvcUndertowApplicationAotTests.java b/framework/webmvc-undertow/src/appTest/java/com/example/webmvc/undertow/WebMvcUndertowApplicationAotTests.java
index c82112df..e0e55d8e 100644
--- a/framework/webmvc-undertow/src/appTest/java/com/example/webmvc/undertow/WebMvcUndertowApplicationAotTests.java
+++ b/framework/webmvc-undertow/src/appTest/java/com/example/webmvc/undertow/WebMvcUndertowApplicationAotTests.java
@@ -33,34 +33,59 @@ class WebMvcUndertowApplicationAotTests {
@Test
void stringResponseBody(WebTestClient client) {
- client.get().exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("Hello from Spring MVC and Undertow"));
+ client.get()
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .isEqualTo("Hello from Spring MVC and Undertow"));
}
@Test
void resourceInPublic(WebTestClient client) {
- client.get().uri("bar.html").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Bar"));
+ client.get()
+ .uri("bar.html")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Bar"));
}
@Test
void resourceInStatic(WebTestClient client) {
- client.get().uri("foo.html").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Foo"));
+ client.get()
+ .uri("foo.html")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Foo"));
}
@Test
void jsonResponseFromSerializedRecord(WebTestClient client) {
- client.get().uri("record").exchange().expectStatus().isOk().expectBody()
- .json("{\"message\":\"Hello from Spring MVC and Undertow\"}");
+ client.get()
+ .uri("record")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"message\":\"Hello from Spring MVC and Undertow\"}");
}
@Test
void sendPostToPostMappingDefinedOnAnInterfaceAndReceiveEchoedJsonResponse(WebTestClient client) {
- client.post().uri("echo").bodyValue("{\"message\": \"Native\"}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).exchange().expectStatus().isOk()
- .expectBody().json("{\"message\":\"Native\"}");
+ client.post()
+ .uri("echo")
+ .bodyValue("{\"message\": \"Native\"}")
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("{\"message\":\"Native\"}");
}
@Test
@@ -73,13 +98,20 @@ class WebMvcUndertowApplicationAotTests {
MultiValueMap formData = new LinkedMultiValueMap<>();
formData.add("firstName", "first-name");
formData.add("lastName", "last-name");
- client.post().uri("/form-submission").contentType(MediaType.MULTIPART_FORM_DATA)
- .body(BodyInserters.fromMultipartData(formData)).exchange().expectStatus().isOk().expectBody().json("""
- {
- "firstName": "first-name",
- "lastName": "last-name"
- }
- """);
+ client.post()
+ .uri("/form-submission")
+ .contentType(MediaType.MULTIPART_FORM_DATA)
+ .body(BodyInserters.fromMultipartData(formData))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .json("""
+ {
+ "firstName": "first-name",
+ "lastName": "last-name"
+ }
+ """);
}
@Test
@@ -99,9 +131,15 @@ class WebMvcUndertowApplicationAotTests {
@Test
void xmlWorks(WebTestClient client) {
- client.post().uri("/xml").contentType(MediaType.APPLICATION_XML)
- .bodyValue("Hello").exchange().expectStatus().isOk().expectBody()
- .xml("Server: Hello");
+ client.post()
+ .uri("/xml")
+ .contentType(MediaType.APPLICATION_XML)
+ .bodyValue("Hello")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .xml("Server: Hello");
}
}
diff --git a/framework/websocket-jetty/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java b/framework/websocket-jetty/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java
index 09c6ac61..122c7c7e 100644
--- a/framework/websocket-jetty/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java
+++ b/framework/websocket-jetty/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java
@@ -31,26 +31,30 @@ class WebSocketJettyApplicationAotTests {
@Test
void clientShouldSendMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Sent 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Sent 'Hello Websocket'"));
}
@Test
void serverShouldReceiveMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Received 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Received 'Hello Websocket'"));
}
@Test
void serverShouldReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Sent 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Sent 'Hello Websocket'"));
}
@Test
void clientShouldReceiveReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Received 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Received 'Hello Websocket'"));
}
}
diff --git a/framework/websocket-stomp/src/appTest/java/com/example/websocket/stomp/WebSocketStompApplicationAotTests.java b/framework/websocket-stomp/src/appTest/java/com/example/websocket/stomp/WebSocketStompApplicationAotTests.java
index 42b86f96..a9dabb51 100644
--- a/framework/websocket-stomp/src/appTest/java/com/example/websocket/stomp/WebSocketStompApplicationAotTests.java
+++ b/framework/websocket-stomp/src/appTest/java/com/example/websocket/stomp/WebSocketStompApplicationAotTests.java
@@ -31,25 +31,31 @@ class WebSocketStompApplicationAotTests {
@Test
void clientShouldConnect(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("STOMP Client connected"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("STOMP Client connected"));
}
@Test
void serverShouldSubscribe(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: subscription"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: subscription"));
}
@Test
void serverShouldReceiveMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> assertThat(output)
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output)
.hasSingleLineContaining("Server: Received 'HelloMessage{name='STOMP Client'}'"));
}
@Test
void clientShouldReceiveReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> assertThat(output)
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output)
.hasSingleLineContaining("Client: Received 'GreetingMessage{content='Hello, STOMP Client!'}'"));
}
diff --git a/framework/websocket-tomcat/src/appTest/java/com/example/websocket/WebSocketApplicationAotTests.java b/framework/websocket-tomcat/src/appTest/java/com/example/websocket/WebSocketApplicationAotTests.java
index 0d7e5c91..f7c54855 100644
--- a/framework/websocket-tomcat/src/appTest/java/com/example/websocket/WebSocketApplicationAotTests.java
+++ b/framework/websocket-tomcat/src/appTest/java/com/example/websocket/WebSocketApplicationAotTests.java
@@ -31,26 +31,30 @@ class WebSocketApplicationAotTests {
@Test
void clientShouldSendMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Sent 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Sent 'Hello Websocket'"));
}
@Test
void serverShouldReceiveMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Received 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Received 'Hello Websocket'"));
}
@Test
void serverShouldReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Sent 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Sent 'Hello Websocket'"));
}
@Test
void clientShouldReceiveReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Received 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Received 'Hello Websocket'"));
}
}
diff --git a/framework/websocket-undertow/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java b/framework/websocket-undertow/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java
index 09c6ac61..122c7c7e 100644
--- a/framework/websocket-undertow/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java
+++ b/framework/websocket-undertow/src/appTest/java/com/example/websocket/jetty/WebSocketJettyApplicationAotTests.java
@@ -31,26 +31,30 @@ class WebSocketJettyApplicationAotTests {
@Test
void clientShouldSendMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Sent 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Sent 'Hello Websocket'"));
}
@Test
void serverShouldReceiveMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Received 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Received 'Hello Websocket'"));
}
@Test
void serverShouldReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Sent 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Server: Sent 'Hello Websocket'"));
}
@Test
void clientShouldReceiveReply(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(10))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Received 'Hello Websocket'"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(10))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Client: Received 'Hello Websocket'"));
}
}
diff --git a/graphql/graphql-webflux-rsocket/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java b/graphql/graphql-webflux-rsocket/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java
index cc83e5d8..b207c883 100644
--- a/graphql/graphql-webflux-rsocket/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java
+++ b/graphql/graphql-webflux-rsocket/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java
@@ -31,8 +31,9 @@ class GraphQlApplicationAotTests {
void getProject() {
TcpClientTransport transport = TcpClientTransport.create(9090);
RSocketGraphQlClient graphQlClient = RSocketGraphQlClient.builder().clientTransport(transport).build();
- Mono projectName = graphQlClient.documentName("project").retrieve("project.name")
- .toEntity(String.class);
+ Mono projectName = graphQlClient.documentName("project")
+ .retrieve("project.name")
+ .toEntity(String.class);
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
}
diff --git a/graphql/graphql-webflux/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java b/graphql/graphql-webflux/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java
index bcf3c4de..8b328585 100644
--- a/graphql/graphql-webflux/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java
+++ b/graphql/graphql-webflux/src/appTest/java/com/example/graphql/webflux/GraphQlApplicationAotTests.java
@@ -37,8 +37,9 @@ class GraphQlApplicationAotTests {
void getProjectUsingHttp(@ApplicationUrl(scheme = ApplicationUrl.Scheme.HTTP) URI applicationUrl) {
WebClient webClient = WebClient.create(applicationUrl.toString() + "/graphql");
HttpGraphQlClient graphQlClient = HttpGraphQlClient.create(webClient);
- Mono projectName = graphQlClient.documentName("project").retrieve("project.name")
- .toEntity(String.class);
+ Mono projectName = graphQlClient.documentName("project")
+ .retrieve("project.name")
+ .toEntity(String.class);
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
}
@@ -46,9 +47,11 @@ class GraphQlApplicationAotTests {
void getProjectUsingWebSocket(@ApplicationUrl(scheme = ApplicationUrl.Scheme.WEBSOCKET) URI applicationUrl) {
WebSocketClient webClient = new ReactorNettyWebSocketClient();
WebSocketGraphQlClient graphQlClient = WebSocketGraphQlClient
- .builder(applicationUrl.toString() + "/graphql", webClient).build();
- Mono projectName = graphQlClient.documentName("project").retrieve("project.name")
- .toEntity(String.class);
+ .builder(applicationUrl.toString() + "/graphql", webClient)
+ .build();
+ Mono projectName = graphQlClient.documentName("project")
+ .retrieve("project.name")
+ .toEntity(String.class);
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
}
diff --git a/graphql/graphql-webmvc/src/appTest/java/com/example/graphql/webmvc/GraphQlApplicationAotTests.java b/graphql/graphql-webmvc/src/appTest/java/com/example/graphql/webmvc/GraphQlApplicationAotTests.java
index d30b6107..0d5c4707 100644
--- a/graphql/graphql-webmvc/src/appTest/java/com/example/graphql/webmvc/GraphQlApplicationAotTests.java
+++ b/graphql/graphql-webmvc/src/appTest/java/com/example/graphql/webmvc/GraphQlApplicationAotTests.java
@@ -37,8 +37,9 @@ class GraphQlApplicationAotTests {
void getProjectUsingHttp(@ApplicationUrl(scheme = ApplicationUrl.Scheme.HTTP) URI applicationUrl) {
WebClient webClient = WebClient.create(applicationUrl.toString() + "/graphql");
HttpGraphQlClient graphQlClient = HttpGraphQlClient.create(webClient);
- Mono projectName = graphQlClient.documentName("project").retrieve("project.name")
- .toEntity(String.class);
+ Mono projectName = graphQlClient.documentName("project")
+ .retrieve("project.name")
+ .toEntity(String.class);
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
}
@@ -46,9 +47,11 @@ class GraphQlApplicationAotTests {
void getProjectUsingWebSocket(@ApplicationUrl(scheme = ApplicationUrl.Scheme.WEBSOCKET) URI applicationUrl) {
WebSocketClient webClient = new ReactorNettyWebSocketClient();
WebSocketGraphQlClient graphQlClient = WebSocketGraphQlClient
- .builder(applicationUrl.toString() + "/graphql", webClient).build();
- Mono projectName = graphQlClient.documentName("project").retrieve("project.name")
- .toEntity(String.class);
+ .builder(applicationUrl.toString() + "/graphql", webClient)
+ .build();
+ Mono projectName = graphQlClient.documentName("project")
+ .retrieve("project.name")
+ .toEntity(String.class);
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
}
diff --git a/integration/integration/src/appTest/java/com/example/integration/IntegrationApplicationTests.java b/integration/integration/src/appTest/java/com/example/integration/IntegrationApplicationTests.java
index 37a30622..7c87b272 100644
--- a/integration/integration/src/appTest/java/com/example/integration/IntegrationApplicationTests.java
+++ b/integration/integration/src/appTest/java/com/example/integration/IntegrationApplicationTests.java
@@ -21,12 +21,20 @@ public class IntegrationApplicationTests {
output.assertThat().hasSingleLineContaining("Starting endpoint: dateSourceEndpoint");
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> output.assertThat().hasLineContaining("Current seconds:"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> output.assertThat().hasLineContaining("Current seconds:"));
- client.get().uri("/integration-graph").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
- .expectBody(String.class).value(graph -> assertThat(graph).contains("null-channel")
- .contains("loggingChannel").contains("dateSourceEndpoint"));
+ client.get()
+ .uri("/integration-graph")
+ .accept(MediaType.APPLICATION_JSON)
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody(String.class)
+ .value(graph -> assertThat(graph).contains("null-channel")
+ .contains("loggingChannel")
+ .contains("dateSourceEndpoint"));
}
}
diff --git a/integration/spring-amqp-rabbit/src/appTest/java/com/example/amqp/AmqpRabbitApplicationAotTests.java b/integration/spring-amqp-rabbit/src/appTest/java/com/example/amqp/AmqpRabbitApplicationAotTests.java
index e6ae01ec..d201c714 100644
--- a/integration/spring-amqp-rabbit/src/appTest/java/com/example/amqp/AmqpRabbitApplicationAotTests.java
+++ b/integration/spring-amqp-rabbit/src/appTest/java/com/example/amqp/AmqpRabbitApplicationAotTests.java
@@ -31,8 +31,9 @@ class AmqpRabbitApplicationAotTests {
@Test
void rabbitListenerMethodReceivesMessageAndSendsResponse(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("++++++ Received: ONEtwo"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("++++++ Received: ONEtwo"));
}
}
diff --git a/integration/spring-kafka-avro/src/appTest/java/com/example/kafka/KafkaAvroApplicationAotTests.java b/integration/spring-kafka-avro/src/appTest/java/com/example/kafka/KafkaAvroApplicationAotTests.java
index 98e6f16d..f251e1f4 100644
--- a/integration/spring-kafka-avro/src/appTest/java/com/example/kafka/KafkaAvroApplicationAotTests.java
+++ b/integration/spring-kafka-avro/src/appTest/java/com/example/kafka/KafkaAvroApplicationAotTests.java
@@ -31,10 +31,14 @@ class KafkaAvroApplicationAotTests {
@Test
void kafkaListenerMethodReceivesMessageAndSendsResponse(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> assertThat(output)
- .hasSingleLineContaining("++++++1:Received Thing1:").hasSingleLineContaining("++++++2:Received Thing2:")
- .hasSingleLineContaining("++++++3:Received Thing3:").hasSingleLineContaining("++++++4:Received Thing4:")
- .hasSingleLineContaining("++++++5:Received Thing5:").hasSingleLineContaining("++++++6:Received Thing6:")
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("++++++1:Received Thing1:")
+ .hasSingleLineContaining("++++++2:Received Thing2:")
+ .hasSingleLineContaining("++++++3:Received Thing3:")
+ .hasSingleLineContaining("++++++4:Received Thing4:")
+ .hasSingleLineContaining("++++++5:Received Thing5:")
+ .hasSingleLineContaining("++++++6:Received Thing6:")
.hasSingleLineContaining("++++++7:Received Thing7:")
.hasSingleLineContaining("++++++8:Received Thing8:"));
}
diff --git a/integration/spring-kafka-streams/src/appTest/java/com/example/kafka/KafkaStreamsApplicationAotTests.java b/integration/spring-kafka-streams/src/appTest/java/com/example/kafka/KafkaStreamsApplicationAotTests.java
index 81c95109..df823c64 100644
--- a/integration/spring-kafka-streams/src/appTest/java/com/example/kafka/KafkaStreamsApplicationAotTests.java
+++ b/integration/spring-kafka-streams/src/appTest/java/com/example/kafka/KafkaStreamsApplicationAotTests.java
@@ -31,8 +31,9 @@ class KafkaStreamsApplicationAotTests {
@Test
void kafkaListenerMethodReceivesMessageAndSendsResponse(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("++++++Received:FOO"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("++++++Received:FOO"));
}
}
diff --git a/integration/spring-kafka/src/appTest/java/com/example/kafka/KafkaApplicationAotTests.java b/integration/spring-kafka/src/appTest/java/com/example/kafka/KafkaApplicationAotTests.java
index 76dd5f48..15b4d376 100644
--- a/integration/spring-kafka/src/appTest/java/com/example/kafka/KafkaApplicationAotTests.java
+++ b/integration/spring-kafka/src/appTest/java/com/example/kafka/KafkaApplicationAotTests.java
@@ -31,7 +31,9 @@ class KafkaApplicationAotTests {
@Test
void kafkaListenerMethodReceivesMessageAndSendsResponse(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> assertThat(output)
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output)
.hasSingleLineContaining("++++++Received: Greeting{message='Hello from GraalVM!'}"));
}
diff --git a/integration/spring-pulsar-reactive/src/appTest/java/com/example/pulsar/SpringPulsarReactiveApplicationAotTests.java b/integration/spring-pulsar-reactive/src/appTest/java/com/example/pulsar/SpringPulsarReactiveApplicationAotTests.java
index ec1c29d6..7e1407f1 100644
--- a/integration/spring-pulsar-reactive/src/appTest/java/com/example/pulsar/SpringPulsarReactiveApplicationAotTests.java
+++ b/integration/spring-pulsar-reactive/src/appTest/java/com/example/pulsar/SpringPulsarReactiveApplicationAotTests.java
@@ -14,8 +14,9 @@ public class SpringPulsarReactiveApplicationAotTests {
@Test
void reactivePulsarListenerMethodReceivesMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30))
- .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Message Received: sample-message-50"));
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output).hasSingleLineContaining("Message Received: sample-message-50"));
}
}
diff --git a/integration/spring-pulsar/src/appTest/java/com/example/pulsar/SpringPulsarApplicationAotTests.java b/integration/spring-pulsar/src/appTest/java/com/example/pulsar/SpringPulsarApplicationAotTests.java
index 14348e18..17ef34ca 100644
--- a/integration/spring-pulsar/src/appTest/java/com/example/pulsar/SpringPulsarApplicationAotTests.java
+++ b/integration/spring-pulsar/src/appTest/java/com/example/pulsar/SpringPulsarApplicationAotTests.java
@@ -14,7 +14,9 @@ public class SpringPulsarApplicationAotTests {
@Test
void pulsarListenerMethodReceivesMessage(AssertableOutput output) {
- Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> assertThat(output)
+ Awaitility.await()
+ .atMost(Duration.ofSeconds(30))
+ .untilAsserted(() -> assertThat(output)
.hasSingleLineContaining("Message Received: Greeting[message=Hello from GraalVM!]"));
}
diff --git a/security/security-ldap/src/appTest/java/com/example/security/ldap/SecurityLdapApplicationAotTests.java b/security/security-ldap/src/appTest/java/com/example/security/ldap/SecurityLdapApplicationAotTests.java
index 61be8d7a..4af60a24 100644
--- a/security/security-ldap/src/appTest/java/com/example/security/ldap/SecurityLdapApplicationAotTests.java
+++ b/security/security-ldap/src/appTest/java/com/example/security/ldap/SecurityLdapApplicationAotTests.java
@@ -17,17 +17,27 @@ public class SecurityLdapApplicationAotTests {
@Test
void homeShouldShowUsername(WebTestClient client) {
- client.get().uri("/").headers((header) -> header.setBasicAuth("user", "password")).exchange().expectStatus()
- .isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello, user!"));
+ client.get()
+ .uri("/")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello, user!"));
}
@Test
void friendlyShouldShowGivenName(WebTestClient client) {
- client.get().uri("/friendly").headers((header) -> header.setBasicAuth("user", "password")).exchange()
- .expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("Hello, Dianne Emu!"));
+ client.get()
+ .uri("/friendly")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .isEqualTo("Hello, Dianne Emu!"));
}
}
diff --git a/security/security-method/src/appTest/java/com/example/security/method/Jsr250AotTests.java b/security/security-method/src/appTest/java/com/example/security/method/Jsr250AotTests.java
index f56ddc34..25f947eb 100644
--- a/security/security-method/src/appTest/java/com/example/security/method/Jsr250AotTests.java
+++ b/security/security-method/src/appTest/java/com/example/security/method/Jsr250AotTests.java
@@ -17,14 +17,13 @@ public class Jsr250AotTests {
void anonymousCanCallOnlyAnonymousMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining(
- "testJsr250Anonymous(): jsr250ProtectedService.anonymous() worked as anonymous")
- .hasSingleLineContaining("testJsr250User(): jsr250ProtectedService.user() failed as anonymous")
- .hasSingleLineContaining("testJsr250Admin(): jsr250ProtectedService.admin() failed as anonymous")
- .hasSingleLineContaining(
- "testJsr250PermitAll(): jsr250ProtectedService.permitAll() worked as anonymous")
- .hasSingleLineContaining(
- "testJsr250DenyAll(): jsr250ProtectedService.denyAll() failed as anonymous");
+ .hasSingleLineContaining(
+ "testJsr250Anonymous(): jsr250ProtectedService.anonymous() worked as anonymous")
+ .hasSingleLineContaining("testJsr250User(): jsr250ProtectedService.user() failed as anonymous")
+ .hasSingleLineContaining("testJsr250Admin(): jsr250ProtectedService.admin() failed as anonymous")
+ .hasSingleLineContaining(
+ "testJsr250PermitAll(): jsr250ProtectedService.permitAll() worked as anonymous")
+ .hasSingleLineContaining("testJsr250DenyAll(): jsr250ProtectedService.denyAll() failed as anonymous");
});
}
@@ -32,9 +31,9 @@ public class Jsr250AotTests {
void userCanCallUserMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("testJsr250User(): jsr250ProtectedService.user() worked as user")
- .hasSingleLineContaining("testJsr250Admin(): jsr250ProtectedService.admin() failed as user")
- .hasSingleLineContaining("testJsr250PermitAll(): jsr250ProtectedService.permitAll() worked as user")
- .hasSingleLineContaining("testJsr250DenyAll(): jsr250ProtectedService.denyAll() failed as user");
+ .hasSingleLineContaining("testJsr250Admin(): jsr250ProtectedService.admin() failed as user")
+ .hasSingleLineContaining("testJsr250PermitAll(): jsr250ProtectedService.permitAll() worked as user")
+ .hasSingleLineContaining("testJsr250DenyAll(): jsr250ProtectedService.denyAll() failed as user");
});
}
@@ -42,10 +41,9 @@ public class Jsr250AotTests {
void adminCanCallAdminMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("testJsr250Admin(): jsr250ProtectedService.admin() worked as admin")
- .hasSingleLineContaining("testJsr250DenyAll(): jsr250ProtectedService.denyAll() failed as admin")
- .hasSingleLineContaining(
- "testJsr250PermitAll(): jsr250ProtectedService.permitAll() worked as admin");
+ .hasSingleLineContaining("testJsr250Admin(): jsr250ProtectedService.admin() worked as admin")
+ .hasSingleLineContaining("testJsr250DenyAll(): jsr250ProtectedService.denyAll() failed as admin")
+ .hasSingleLineContaining("testJsr250PermitAll(): jsr250ProtectedService.permitAll() worked as admin");
});
}
diff --git a/security/security-method/src/appTest/java/com/example/security/method/PostAuthorizeAotTests.java b/security/security-method/src/appTest/java/com/example/security/method/PostAuthorizeAotTests.java
index acce7247..66aaea0c 100644
--- a/security/security-method/src/appTest/java/com/example/security/method/PostAuthorizeAotTests.java
+++ b/security/security-method/src/appTest/java/com/example/security/method/PostAuthorizeAotTests.java
@@ -16,12 +16,13 @@ public class PostAuthorizeAotTests {
@Test
void anonymousCanCallOnlyAnonymousMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
- assertThat(output).hasSingleLineContaining(
- "testPostAuthorizeAnonymous(): postAuthorizeProtectedService.anonymous() worked as anonymous")
- .hasSingleLineContaining(
- "testPostAuthorizeUser(): postAuthorizeProtectedService.user() failed as anonymous")
- .hasSingleLineContaining(
- "testPostAuthorizeAdmin(): postAuthorizeProtectedService.admin() failed as anonymous");
+ assertThat(output)
+ .hasSingleLineContaining(
+ "testPostAuthorizeAnonymous(): postAuthorizeProtectedService.anonymous() worked as anonymous")
+ .hasSingleLineContaining(
+ "testPostAuthorizeUser(): postAuthorizeProtectedService.user() failed as anonymous")
+ .hasSingleLineContaining(
+ "testPostAuthorizeAdmin(): postAuthorizeProtectedService.admin() failed as anonymous");
});
}
@@ -29,10 +30,9 @@ public class PostAuthorizeAotTests {
void userCanCallUserMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining(
- "testPostAuthorizeUser(): postAuthorizeProtectedService.user() worked as user")
- .hasSingleLineContaining(
- "testPostAuthorizeAdmin(): postAuthorizeProtectedService.admin() failed as user");
+ .hasSingleLineContaining("testPostAuthorizeUser(): postAuthorizeProtectedService.user() worked as user")
+ .hasSingleLineContaining(
+ "testPostAuthorizeAdmin(): postAuthorizeProtectedService.admin() failed as user");
});
}
diff --git a/security/security-method/src/appTest/java/com/example/security/method/PreAuthorizeAotTests.java b/security/security-method/src/appTest/java/com/example/security/method/PreAuthorizeAotTests.java
index f517693b..ce3441c6 100644
--- a/security/security-method/src/appTest/java/com/example/security/method/PreAuthorizeAotTests.java
+++ b/security/security-method/src/appTest/java/com/example/security/method/PreAuthorizeAotTests.java
@@ -17,10 +17,10 @@ class PreAuthorizeAotTests {
void anonymousCanCallOnlyAnonymousMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining(
- "testAnonymous(): preAuthorizeProtectedService.anonymous() worked as anonymous")
- .hasSingleLineContaining("testUser(): preAuthorizeProtectedService.user() failed as anonymous")
- .hasSingleLineContaining("testAdmin(): preAuthorizeProtectedService.admin() failed as anonymous");
+ .hasSingleLineContaining(
+ "testAnonymous(): preAuthorizeProtectedService.anonymous() worked as anonymous")
+ .hasSingleLineContaining("testUser(): preAuthorizeProtectedService.user() failed as anonymous")
+ .hasSingleLineContaining("testAdmin(): preAuthorizeProtectedService.admin() failed as anonymous");
});
}
@@ -28,7 +28,7 @@ class PreAuthorizeAotTests {
void userCanCallUserMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output).hasSingleLineContaining("testUser(): preAuthorizeProtectedService.user() worked as user")
- .hasSingleLineContaining("testAdmin(): preAuthorizeProtectedService.admin() failed as user");
+ .hasSingleLineContaining("testAdmin(): preAuthorizeProtectedService.admin() failed as user");
});
}
@@ -36,7 +36,7 @@ class PreAuthorizeAotTests {
void adminCanCallAdminMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("testAdmin(): preAuthorizeProtectedService.admin() worked as admin");
+ .hasSingleLineContaining("testAdmin(): preAuthorizeProtectedService.admin() worked as admin");
});
}
diff --git a/security/security-method/src/appTest/java/com/example/security/method/SecuredAotTests.java b/security/security-method/src/appTest/java/com/example/security/method/SecuredAotTests.java
index c66cf9ee..8fef3e41 100644
--- a/security/security-method/src/appTest/java/com/example/security/method/SecuredAotTests.java
+++ b/security/security-method/src/appTest/java/com/example/security/method/SecuredAotTests.java
@@ -17,10 +17,10 @@ public class SecuredAotTests {
void anonymousCanCallOnlyAnonymousMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining(
- "testSecuredAnonymous(): securedProtectedService.anonymous() worked as anonymous")
- .hasSingleLineContaining("testSecuredUser(): securedProtectedService.user() failed as anonymous")
- .hasSingleLineContaining("testSecuredAdmin(): securedProtectedService.admin() failed as anonymous");
+ .hasSingleLineContaining(
+ "testSecuredAnonymous(): securedProtectedService.anonymous() worked as anonymous")
+ .hasSingleLineContaining("testSecuredUser(): securedProtectedService.user() failed as anonymous")
+ .hasSingleLineContaining("testSecuredAdmin(): securedProtectedService.admin() failed as anonymous");
});
}
@@ -28,8 +28,8 @@ public class SecuredAotTests {
void userCanCallUserMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("testSecuredUser(): securedProtectedService.user() worked as user")
- .hasSingleLineContaining("testSecuredAdmin(): securedProtectedService.admin() failed as user");
+ .hasSingleLineContaining("testSecuredUser(): securedProtectedService.user() worked as user")
+ .hasSingleLineContaining("testSecuredAdmin(): securedProtectedService.admin() failed as user");
});
}
@@ -37,7 +37,7 @@ public class SecuredAotTests {
void adminCanCallAdminMethod(AssertableOutput output) {
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
assertThat(output)
- .hasSingleLineContaining("testSecuredAdmin(): securedProtectedService.admin() worked as admin");
+ .hasSingleLineContaining("testSecuredAdmin(): securedProtectedService.admin() worked as admin");
});
}
diff --git a/security/security-oauth2-resource-server/src/appTest/java/com/example/security/oauth2resourceserver/OAuth2ResourceServerApplicationAotTests.java b/security/security-oauth2-resource-server/src/appTest/java/com/example/security/oauth2resourceserver/OAuth2ResourceServerApplicationAotTests.java
index 14b1731b..d253627c 100644
--- a/security/security-oauth2-resource-server/src/appTest/java/com/example/security/oauth2resourceserver/OAuth2ResourceServerApplicationAotTests.java
+++ b/security/security-oauth2-resource-server/src/appTest/java/com/example/security/oauth2resourceserver/OAuth2ResourceServerApplicationAotTests.java
@@ -18,16 +18,28 @@ public class OAuth2ResourceServerApplicationAotTests {
@Test
void shouldRespondWhenTokenPresent(WebTestClient client) {
- client.get().uri("/").header("Authorization", bearer(NONE_JWT)).exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("Hello, subject!"));
+ client.get()
+ .uri("/")
+ .header("Authorization", bearer(NONE_JWT))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("Hello, subject!"));
}
@Test
void shouldAllowGetWhenTokenWithReadScope(WebTestClient client) {
- client.get().uri("/message").header("Authorization", bearer(READ_JWT)).exchange().expectStatus().isOk()
- .expectBody().consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("secret message"));
+ client.get()
+ .uri("/message")
+ .header("Authorization", bearer(READ_JWT))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("secret message"));
}
@Test
@@ -37,16 +49,27 @@ public class OAuth2ResourceServerApplicationAotTests {
@Test
void shouldAllowPostWhenTokenWithScope(WebTestClient client) {
- client.post().uri("/message").header("Authorization", bearer(WRITE_JWT)).bodyValue("my message").exchange()
- .expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("Message was created. Content: my message"));
+ client.post()
+ .uri("/message")
+ .header("Authorization", bearer(WRITE_JWT))
+ .bodyValue("my message")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .isEqualTo("Message was created. Content: my message"));
}
@Test
void shouldBlockPostWhenTokenWithBoScope(WebTestClient client) {
- client.post().uri("/message").header("Authorization", bearer(NONE_JWT)).bodyValue("my message").exchange()
- .expectStatus().isForbidden();
+ client.post()
+ .uri("/message")
+ .header("Authorization", bearer(NONE_JWT))
+ .bodyValue("my message")
+ .exchange()
+ .expectStatus()
+ .isForbidden();
}
private static String bearer(String token) {
diff --git a/security/security-thymeleaf/src/appTest/java/com/example/security/thymeleaf/SecurityThymeleafApplicationAotTests.java b/security/security-thymeleaf/src/appTest/java/com/example/security/thymeleaf/SecurityThymeleafApplicationAotTests.java
index 3e3f2b34..168258b7 100644
--- a/security/security-thymeleaf/src/appTest/java/com/example/security/thymeleaf/SecurityThymeleafApplicationAotTests.java
+++ b/security/security-thymeleaf/src/appTest/java/com/example/security/thymeleaf/SecurityThymeleafApplicationAotTests.java
@@ -17,27 +17,44 @@ public class SecurityThymeleafApplicationAotTests {
@Test
void homeShouldNotBeProtectedWithNoCredentials(WebTestClient client) {
- client.get().uri("/").exchange().expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Click here to see a greeting."));
+ client.get()
+ .uri("/")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .contains("Click here to see a greeting."));
}
@Test
void helloShouldShowUsernameWithRoleUser(WebTestClient client) {
- client.get().uri("/hello").headers((header) -> header.setBasicAuth("user", "password")).exchange()
- .expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .contains("Hello user").contains("Logged in user: user")
- .contains("Roles: [ROLE_USER]"));
+ client.get()
+ .uri("/hello")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .contains("Hello user")
+ .contains("Logged in user: user")
+ .contains("Roles: [ROLE_USER]"));
}
@Test
void helloShouldNotShowUsernameWithRoleAdmin(WebTestClient client) {
- client.get().uri("/hello").headers((header) -> header.setBasicAuth("admin", "password")).exchange()
- .expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .doesNotContain("Hello admin").contains("Logged in user: admin")
- .contains("Roles: [ROLE_ADMIN]"));
+ client.get()
+ .uri("/hello")
+ .headers((header) -> header.setBasicAuth("admin", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
+ .doesNotContain("Hello admin")
+ .contains("Logged in user: admin")
+ .contains("Roles: [ROLE_ADMIN]"));
}
}
diff --git a/security/security-webflux/src/appTest/java/com/example/security/webflux/SecurityWebFluxApplicationAotTests.java b/security/security-webflux/src/appTest/java/com/example/security/webflux/SecurityWebFluxApplicationAotTests.java
index fe367ca2..d13bba25 100644
--- a/security/security-webflux/src/appTest/java/com/example/security/webflux/SecurityWebFluxApplicationAotTests.java
+++ b/security/security-webflux/src/appTest/java/com/example/security/webflux/SecurityWebFluxApplicationAotTests.java
@@ -28,8 +28,13 @@ class SecurityWebFluxApplicationAotTests {
@Test
void anonymousShouldBeAccessibleWithoutCredentials(WebTestClient client) {
- client.get().uri("/rest/anonymous").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("anonymous"));
+ client.get()
+ .uri("/rest/anonymous")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("anonymous"));
}
@Test
@@ -39,16 +44,25 @@ class SecurityWebFluxApplicationAotTests {
@Test
void authorizedShouldBeAccessibleWithCredentials(WebTestClient client) {
- client.get().uri("/rest/authorized").headers((header) -> header.setBasicAuth("user", "password")).exchange()
- .expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("authorized: user"));
+ client.get()
+ .uri("/rest/authorized")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("authorized: user"));
}
@Test
void authorizedShouldBeProtectedWithWrongCredentials(WebTestClient client) {
- client.get().uri("/rest/authorized").headers((header) -> header.setBasicAuth("wrong-user", "wrong-password"))
- .exchange().expectStatus().isUnauthorized();
+ client.get()
+ .uri("/rest/authorized")
+ .headers((header) -> header.setBasicAuth("wrong-user", "wrong-password"))
+ .exchange()
+ .expectStatus()
+ .isUnauthorized();
}
@Test
@@ -58,21 +72,34 @@ class SecurityWebFluxApplicationAotTests {
@Test
void adminShouldBeAccessibleWithCredentials(WebTestClient client) {
- client.get().uri("/rest/admin").headers((header) -> header.setBasicAuth("admin", "password")).exchange()
- .expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("admin: admin"));
+ client.get()
+ .uri("/rest/admin")
+ .headers((header) -> header.setBasicAuth("admin", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("admin: admin"));
}
@Test
void adminShouldBeProtectedWithWrongCredentials(WebTestClient client) {
- client.get().uri("/rest/admin").headers((header) -> header.setBasicAuth("wrong-admin", "wrong-password"))
- .exchange().expectStatus().isUnauthorized();
+ client.get()
+ .uri("/rest/admin")
+ .headers((header) -> header.setBasicAuth("wrong-admin", "wrong-password"))
+ .exchange()
+ .expectStatus()
+ .isUnauthorized();
}
@Test
void adminShouldBeProtectedWithWrongRole(WebTestClient client) {
- client.get().uri("/rest/admin").headers((header) -> header.setBasicAuth("user", "password")).exchange()
- .expectStatus().isForbidden();
+ client.get()
+ .uri("/rest/admin")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isForbidden();
}
@Test
diff --git a/security/security-webmvc/src/appTest/java/com/example/security/webmvc/SecurityWebMvcApplicationAotTests.java b/security/security-webmvc/src/appTest/java/com/example/security/webmvc/SecurityWebMvcApplicationAotTests.java
index 3a6c4bce..62f2eb87 100644
--- a/security/security-webmvc/src/appTest/java/com/example/security/webmvc/SecurityWebMvcApplicationAotTests.java
+++ b/security/security-webmvc/src/appTest/java/com/example/security/webmvc/SecurityWebMvcApplicationAotTests.java
@@ -28,8 +28,13 @@ class SecurityWebMvcApplicationAotTests {
@Test
void anonymousShouldBeAccessibleWithoutCredentials(WebTestClient client) {
- client.get().uri("/rest/anonymous").exchange().expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("anonymous"));
+ client.get()
+ .uri("/rest/anonymous")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("anonymous"));
}
@Test
@@ -39,16 +44,25 @@ class SecurityWebMvcApplicationAotTests {
@Test
void authorizedShouldBeAccessibleWithCredentials(WebTestClient client) {
- client.get().uri("/rest/authorized").headers((header) -> header.setBasicAuth("user", "password")).exchange()
- .expectStatus().isOk().expectBody()
- .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
- .isEqualTo("authorized: user"));
+ client.get()
+ .uri("/rest/authorized")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith(
+ (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("authorized: user"));
}
@Test
void authorizedShouldBeProtectedWithWrongCredentials(WebTestClient client) {
- client.get().uri("/rest/authorized").headers((header) -> header.setBasicAuth("wrong-user", "wrong-password"))
- .exchange().expectStatus().isUnauthorized();
+ client.get()
+ .uri("/rest/authorized")
+ .headers((header) -> header.setBasicAuth("wrong-user", "wrong-password"))
+ .exchange()
+ .expectStatus()
+ .isUnauthorized();
}
@Test
@@ -58,21 +72,34 @@ class SecurityWebMvcApplicationAotTests {
@Test
void adminShouldBeAccessibleWithCredentials(WebTestClient client) {
- client.get().uri("/rest/admin").headers((header) -> header.setBasicAuth("admin", "password")).exchange()
- .expectStatus().isOk().expectBody().consumeWith(
- (result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("admin: admin"));
+ client.get()
+ .uri("/rest/admin")
+ .headers((header) -> header.setBasicAuth("admin", "password"))
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("admin: admin"));
}
@Test
void adminShouldBeProtectedWithWrongCredentials(WebTestClient client) {
- client.get().uri("/rest/admin").headers((header) -> header.setBasicAuth("wrong-admin", "wrong-password"))
- .exchange().expectStatus().isUnauthorized();
+ client.get()
+ .uri("/rest/admin")
+ .headers((header) -> header.setBasicAuth("wrong-admin", "wrong-password"))
+ .exchange()
+ .expectStatus()
+ .isUnauthorized();
}
@Test
void adminShouldBeProtectedWithWrongRole(WebTestClient client) {
- client.get().uri("/rest/admin").headers((header) -> header.setBasicAuth("user", "password")).exchange()
- .expectStatus().isForbidden();
+ client.get()
+ .uri("/rest/admin")
+ .headers((header) -> header.setBasicAuth("user", "password"))
+ .exchange()
+ .expectStatus()
+ .isForbidden();
}
@Test
diff --git a/session/session-jdbc/src/appTest/java/com/example/session/jdbc/SessionJdbcApplicationTests.java b/session/session-jdbc/src/appTest/java/com/example/session/jdbc/SessionJdbcApplicationTests.java
index 70f57688..0bf55a19 100644
--- a/session/session-jdbc/src/appTest/java/com/example/session/jdbc/SessionJdbcApplicationTests.java
+++ b/session/session-jdbc/src/appTest/java/com/example/session/jdbc/SessionJdbcApplicationTests.java
@@ -13,12 +13,28 @@ public class SessionJdbcApplicationTests {
@Test
void shouldIncreaseCounter(WebTestClient client) {
AtomicReference sessionId = new AtomicReference<>();
- client.get().uri("/counter").exchange().expectCookie().value("SESSIONCOOKIE", sessionId::set).expectBody()
- .jsonPath("$.counter").isEqualTo(1);
- client.get().uri("/counter").cookie("SESSIONCOOKIE", sessionId.get()).exchange().expectBody()
- .jsonPath("$.counter").isEqualTo(2);
- client.get().uri("/counter").cookie("SESSIONCOOKIE", sessionId.get()).exchange().expectBody()
- .jsonPath("$.counter").isEqualTo(3);
+ client.get()
+ .uri("/counter")
+ .exchange()
+ .expectCookie()
+ .value("SESSIONCOOKIE", sessionId::set)
+ .expectBody()
+ .jsonPath("$.counter")
+ .isEqualTo(1);
+ client.get()
+ .uri("/counter")
+ .cookie("SESSIONCOOKIE", sessionId.get())
+ .exchange()
+ .expectBody()
+ .jsonPath("$.counter")
+ .isEqualTo(2);
+ client.get()
+ .uri("/counter")
+ .cookie("SESSIONCOOKIE", sessionId.get())
+ .exchange()
+ .expectBody()
+ .jsonPath("$.counter")
+ .isEqualTo(3);
}
}
diff --git a/session/session-redis-webflux/src/appTest/java/com/example/session/redis/webflux/SessionRedisWebfluxApplicationTests.java b/session/session-redis-webflux/src/appTest/java/com/example/session/redis/webflux/SessionRedisWebfluxApplicationTests.java
index d5228c9b..3162c7e0 100644
--- a/session/session-redis-webflux/src/appTest/java/com/example/session/redis/webflux/SessionRedisWebfluxApplicationTests.java
+++ b/session/session-redis-webflux/src/appTest/java/com/example/session/redis/webflux/SessionRedisWebfluxApplicationTests.java
@@ -13,12 +13,34 @@ public class SessionRedisWebfluxApplicationTests {
@Test
void shouldIncreaseCounter(WebTestClient client) {
AtomicReference sessionId = new AtomicReference<>();
- client.get().uri("/counter").exchange().expectStatus().isOk().expectCookie().value("SESSION", sessionId::set)
- .expectBody().jsonPath("$.counter").isEqualTo(1);
- client.get().uri("/counter").cookie("SESSION", sessionId.get()).exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.counter").isEqualTo(2);
- client.get().uri("/counter").cookie("SESSION", sessionId.get()).exchange().expectStatus().isOk().expectBody()
- .jsonPath("$.counter").isEqualTo(3);
+ client.get()
+ .uri("/counter")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectCookie()
+ .value("SESSION", sessionId::set)
+ .expectBody()
+ .jsonPath("$.counter")
+ .isEqualTo(1);
+ client.get()
+ .uri("/counter")
+ .cookie("SESSION", sessionId.get())
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.counter")
+ .isEqualTo(2);
+ client.get()
+ .uri("/counter")
+ .cookie("SESSION", sessionId.get())
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBody()
+ .jsonPath("$.counter")
+ .isEqualTo(3);
}
}