From fe352b96a7a832a21f1656d81f8fed22afb6b205 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Mon, 18 Jul 2022 16:20:57 +0200 Subject: [PATCH] Fix template --- ...lass-name-base}CodestartTest.tpl.qute.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/extension-codestart/java/integration-tests/src/test/java/{package-name.dir}/it/{class-name-base}CodestartTest.tpl.qute.java b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/extension-codestart/java/integration-tests/src/test/java/{package-name.dir}/it/{class-name-base}CodestartTest.tpl.qute.java index e3bb749f046cd..151c47b423257 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/extension-codestart/java/integration-tests/src/test/java/{package-name.dir}/it/{class-name-base}CodestartTest.tpl.qute.java +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/extension-codestart/java/integration-tests/src/test/java/{package-name.dir}/it/{class-name-base}CodestartTest.tpl.qute.java @@ -1,12 +1,11 @@ {#if input.extra-codestarts.contains("integration-tests")} package {package-name}.it; -import static io.restassured.RestAssured.given; -import static org.hamcrest.Matchers.is; - import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; -import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language; +import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; public class {class-name-base}CodestartTest { @@ -16,11 +15,24 @@ public class {class-name-base}CodestartTest { .setupStandaloneExtensionTest("{group-id}:{namespace.id}{extension.id}") .build(); + /** + * Make sure the generated code meets the expectations. + *
+ * The generated code uses mocked data to be immutable and allow snapshot testing. + *

+ * + * Read the doc:
+ * {@link https://quarkus.io/guides/extension-codestart#integration-test} + */ @Test void testContent() throws Throwable { - codestartTest.checkGeneratedSource("org.acme.{class-name-base}Resource"); + //codestartTest.checkGeneratedSource("org.acme.SomeClass"); + //codestartTest.assertThatGeneratedFileMatchSnapshot(Language.JAVA, "\"src/main/resources/some-resource.ext"); } + /** + * This test runs the build (with tests) on generated projects for all selected languages + */ @Test void buildAllProjects() throws Throwable { codestartTest.buildAllProjects();