diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/test/RenderedResultsDisabledTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/test/RenderedResultsDisabledTest.java index 867778d4ee832..805586405f21a 100644 --- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/test/RenderedResultsDisabledTest.java +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/test/RenderedResultsDisabledTest.java @@ -1,5 +1,6 @@ package io.quarkus.qute.deployment.test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import jakarta.enterprise.inject.Instance; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.qute.RenderedResults; +import io.quarkus.qute.Template; import io.quarkus.test.QuarkusUnitTest; public class RenderedResultsDisabledTest { @@ -25,9 +27,13 @@ public class RenderedResultsDisabledTest { @Inject Instance renderedResults; + @Inject + Template foo; + @Test public void testRenderedResultsNotRegistered() { assertTrue(renderedResults.isUnsatisfied()); + assertEquals("Morna", foo.data("name", "Morna").render()); } } diff --git a/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/TemplateProducer.java b/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/TemplateProducer.java index 55cf3151aec9a..ae7d0519d5e94 100644 --- a/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/TemplateProducer.java +++ b/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/TemplateProducer.java @@ -68,7 +68,7 @@ public class TemplateProducer { templateVariants.put(entry.getKey(), var); } this.templateVariants = Collections.unmodifiableMap(templateVariants); - this.renderedResults = launchMode == LaunchMode.TEST ? renderedResults.get() : null; + this.renderedResults = launchMode == LaunchMode.TEST && renderedResults.isResolvable() ? renderedResults.get() : null; this.injectedTemplates = launchMode == LaunchMode.DEVELOPMENT ? Collections.synchronizedList(new ArrayList<>()) : null; LOGGER.debugf("Initializing Qute variant templates: %s", templateVariants); }