Apply formatting update to appTest source set
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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("<li>Brian Goetz</li>").contains("<li>Joshua Bloch</li>"));
|
||||
client.get()
|
||||
.uri("/authors")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<li>Brian Goetz</li>")
|
||||
.contains("<li>Joshua Bloch</li>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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("<li>Brian Goetz</li>").contains("<li>Joshua Bloch</li>"));
|
||||
client.get()
|
||||
.uri("/authors")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<li>Brian Goetz</li>")
|
||||
.contains("<li>Joshua Bloch</li>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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("<li>Brian Goetz</li>").contains("<li>Joshua Bloch</li>"));
|
||||
client.get()
|
||||
.uri("/authors")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<li>Brian Goetz</li>")
|
||||
.contains("<li>Joshua Bloch</li>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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("<li>Brian Goetz</li>").contains("<li>Joshua Bloch</li>"));
|
||||
client.get()
|
||||
.uri("/authors")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<li>Brian Goetz</li>")
|
||||
.contains("<li>Joshua Bloch</li>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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("<span>Hello</span>").contains("<span>world</span>"));
|
||||
client.get()
|
||||
.uri("/greeting")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<span>Hello</span>")
|
||||
.contains("<span>world</span>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void authorListIsRendered(WebTestClient client) {
|
||||
client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
|
||||
.contains("<li>Brian Goetz</li>").contains("<li>Joshua Bloch</li>"));
|
||||
client.get()
|
||||
.uri("/authors")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<li>Brian Goetz</li>")
|
||||
.contains("<li>Joshua Bloch</li>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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("<span>Hello</span>").contains("<span>world</span>"));
|
||||
client.get()
|
||||
.uri("/greeting")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<span>Hello</span>")
|
||||
.contains("<span>world</span>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void authorListIsRendered(WebTestClient client) {
|
||||
client.get().uri("/authors").exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
|
||||
.contains("<li>Brian Goetz</li>").contains("<li>Joshua Bloch</li>"));
|
||||
client.get()
|
||||
.uri("/authors")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith(
|
||||
(result) -> assertThat(new String(result.getResponseBodyContent())).contains("<li>Brian Goetz</li>")
|
||||
.contains("<li>Joshua Bloch</li>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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?"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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?"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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')");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}]}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> 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<String> 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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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..."));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'}]}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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()");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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()"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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("<request><message>Hello</message></request>").exchange().expectStatus().isOk().expectBody()
|
||||
.xml("<response><message>Server: Hello</message></response>");
|
||||
client.post()
|
||||
.uri("/xml")
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.bodyValue("<request><message>Hello</message></request>")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.xml("<response><message>Server: Hello</message></response>");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -92,9 +117,14 @@ class WebfluxJettyApplicationAotTests {
|
||||
// reactive
|
||||
// pipeline
|
||||
AtomicReference<List<String>> 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 {
|
||||
|
||||
@@ -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<List<String>> 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();
|
||||
|
||||
@@ -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<List<String>> 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("<request><message>Hello</message></request>").exchange().expectStatus().isOk().expectBody()
|
||||
.xml("<response><message>Server: Hello</message></response>");
|
||||
client.post()
|
||||
.uri("/xml")
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.bodyValue("<request><message>Hello</message></request>")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.xml("<response><message>Server: Hello</message></response>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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("<request><message>Hello</message></request>").exchange().expectStatus().isOk().expectBody()
|
||||
.xml("<response><message>Server: Hello</message></response>");
|
||||
client.post()
|
||||
.uri("/xml")
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.bodyValue("<request><message>Hello</message></request>")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.xml("<response><message>Server: Hello</message></response>");
|
||||
}
|
||||
|
||||
@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<List<String>> 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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<String, String> 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("<Request><message>Hello</message></Request>").exchange().expectStatus().isOk().expectBody()
|
||||
.xml("<Response><message>Server: Hello</message></Response>");
|
||||
client.post()
|
||||
.uri("/xml")
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.bodyValue("<Request><message>Hello</message></Request>")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.xml("<Response><message>Server: Hello</message></Response>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<String, String> 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("<Request><message>Hello</message></Request>").exchange().expectStatus().isOk().expectBody()
|
||||
.xml("<Response><message>Server: Hello</message></Response>");
|
||||
client.post()
|
||||
.uri("/xml")
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.bodyValue("<Request><message>Hello</message></Request>")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.xml("<Response><message>Server: Hello</message></Response>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<String, String> 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("<Request><message>Hello</message></Request>").exchange().expectStatus().isOk().expectBody()
|
||||
.xml("<Response><message>Server: Hello</message></Response>");
|
||||
client.post()
|
||||
.uri("/xml")
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.bodyValue("<Request><message>Hello</message></Request>")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.xml("<Response><message>Server: Hello</message></Response>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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!'}'"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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'"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,8 +31,9 @@ class GraphQlApplicationAotTests {
|
||||
void getProject() {
|
||||
TcpClientTransport transport = TcpClientTransport.create(9090);
|
||||
RSocketGraphQlClient graphQlClient = RSocketGraphQlClient.builder().clientTransport(transport).build();
|
||||
Mono<String> projectName = graphQlClient.documentName("project").retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
Mono<String> projectName = graphQlClient.documentName("project")
|
||||
.retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> projectName = graphQlClient.documentName("project").retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
Mono<String> 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<String> projectName = graphQlClient.documentName("project").retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
.builder(applicationUrl.toString() + "/graphql", webClient)
|
||||
.build();
|
||||
Mono<String> projectName = graphQlClient.documentName("project")
|
||||
.retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> projectName = graphQlClient.documentName("project").retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
Mono<String> 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<String> projectName = graphQlClient.documentName("project").retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
.builder(applicationUrl.toString() + "/graphql", webClient)
|
||||
.build();
|
||||
Mono<String> projectName = graphQlClient.documentName("project")
|
||||
.retrieve("project.name")
|
||||
.toEntity(String.class);
|
||||
StepVerifier.create(projectName).expectNext("Spring Framework").expectComplete().verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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:"));
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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!'}"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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!]"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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!"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 <a href=\"/hello\">here</a> to see a greeting."));
|
||||
client.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
|
||||
.contains("Click <a href=\"/hello\">here</a> 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 <span>user</span>").contains("Logged in user: <span>user</span>")
|
||||
.contains("Roles: <span>[ROLE_USER]</span>"));
|
||||
client.get()
|
||||
.uri("/hello")
|
||||
.headers((header) -> header.setBasicAuth("user", "password"))
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
|
||||
.contains("Hello <span>user</span>")
|
||||
.contains("Logged in user: <span>user</span>")
|
||||
.contains("Roles: <span>[ROLE_USER]</span>"));
|
||||
}
|
||||
|
||||
@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 <span>admin</span>").contains("Logged in user: <span>admin</span>")
|
||||
.contains("Roles: <span>[ROLE_ADMIN]</span>"));
|
||||
client.get()
|
||||
.uri("/hello")
|
||||
.headers((header) -> header.setBasicAuth("admin", "password"))
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent()))
|
||||
.doesNotContain("Hello <span>admin</span>")
|
||||
.contains("Logged in user: <span>admin</span>")
|
||||
.contains("Roles: <span>[ROLE_ADMIN]</span>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,12 +13,28 @@ public class SessionJdbcApplicationTests {
|
||||
@Test
|
||||
void shouldIncreaseCounter(WebTestClient client) {
|
||||
AtomicReference<String> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,12 +13,34 @@ public class SessionRedisWebfluxApplicationTests {
|
||||
@Test
|
||||
void shouldIncreaseCounter(WebTestClient client) {
|
||||
AtomicReference<String> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user