diff --git a/ci/smoke-tests.yml b/ci/smoke-tests.yml index adcd3a35..46e103a3 100644 --- a/ci/smoke-tests.yml +++ b/ci/smoke-tests.yml @@ -37,6 +37,7 @@ smoke_tests: - spring-kafka - spring-kafka-avro - spring-kafka-streams + - thymeleaf-webmvc - tracing-brave-zipkin - transactional - transactional-event-listener diff --git a/settings.gradle b/settings.gradle index 3c411e48..18f19db4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -65,6 +65,7 @@ include "spring-amqp-rabbit" include "spring-kafka" include "spring-kafka-avro" include "spring-kafka-streams" +include "thymeleaf-webmvc" include "tracing-brave-zipkin" include "transactional" include "transactional-event-listener" diff --git a/thymeleaf-webmvc/README.adoc b/thymeleaf-webmvc/README.adoc new file mode 100644 index 00000000..ad337dbf --- /dev/null +++ b/thymeleaf-webmvc/README.adoc @@ -0,0 +1 @@ +Tests if Thymeleaf view rendering works with WebMVC diff --git a/thymeleaf-webmvc/build.gradle b/thymeleaf-webmvc/build.gradle new file mode 100644 index 00000000..caa56698 --- /dev/null +++ b/thymeleaf-webmvc/build.gradle @@ -0,0 +1,21 @@ +plugins { + id 'java' + id 'org.springframework.boot' + id 'org.springframework.aot.smoke-test' + id 'org.graalvm.buildtools.native' +} + +dependencies { + implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)) + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.springframework.boot:spring-boot-starter-thymeleaf") + + testImplementation("org.springframework.boot:spring-boot-starter-test") + + aotTestImplementation(project(":aot-smoke-test-support")) + aotTestImplementation("org.awaitility:awaitility:4.2.0") +} + +aotSmokeTest { + webApplication = true +} diff --git a/thymeleaf-webmvc/src/aotTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java b/thymeleaf-webmvc/src/aotTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java new file mode 100644 index 00000000..462e3009 --- /dev/null +++ b/thymeleaf-webmvc/src/aotTest/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationAotTests.java @@ -0,0 +1,27 @@ +package com.example.thymeleaf.webmvc; + +import org.junit.jupiter.api.Test; + +import org.springframework.aot.smoketest.support.junit.AotSmokeTest; +import org.springframework.test.web.reactive.server.WebTestClient; + +import static org.assertj.core.api.Assertions.assertThat; + +@AotSmokeTest +class ThymeleafWebMvcApplicationAotTests { + + @Test + void greetingIsRendered(WebTestClient client) { + client.get().uri("/greeting").exchange().expectStatus().isOk().expectBody() + .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())) + .contains("Hello").contains("world")); + } + + @Test + void authorListIsRendered(WebTestClient client) { + client.get().uri("/authors").exchange().expectStatus().isOk().expectBody() + .consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())) + .contains("
+ Greeting + Who +
+ + + + + diff --git a/thymeleaf-webmvc/src/test/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationTests.java b/thymeleaf-webmvc/src/test/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationTests.java new file mode 100644 index 00000000..dd59c3f8 --- /dev/null +++ b/thymeleaf-webmvc/src/test/java/com/example/thymeleaf/webmvc/ThymeleafWebMvcApplicationTests.java @@ -0,0 +1,14 @@ +package com.example.thymeleaf.webmvc; + +import org.junit.jupiter.api.Test; + +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ThymeleafWebMvcApplicationTests { + + @Test + void contextLoads() { + } + +}