diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/MapTemplateExtensionsTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/MapTemplateExtensionsTest.java new file mode 100644 index 0000000000000..d2fb6dff0e675 --- /dev/null +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/MapTemplateExtensionsTest.java @@ -0,0 +1,36 @@ +package io.quarkus.qute.deployment.extensions; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Map; + +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.qute.CheckedTemplate; +import io.quarkus.qute.TemplateInstance; +import io.quarkus.test.QuarkusUnitTest; + +public class MapTemplateExtensionsTest { + + @RegisterExtension + static final QuarkusUnitTest config = new QuarkusUnitTest() + .withApplicationRoot(root -> root + .addClass(Templates.class) + .addAsResource(new StringAsset( + "{map.foo}::{map['bar']}::{map.keys}::{map.empty}::{map.get('foo')}"), + "templates/map.html")); + + @Test + public void testMap() { + assertEquals("1::5::[foo, bar]::false::1", Templates.map(Map.of("foo", 1, "bar", 5)).render()); + } + + @CheckedTemplate(basePath = "") + public static class Templates { + + static native TemplateInstance map(Map map); + } + +}