-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...oyment/src/test/java/io/quarkus/qute/deployment/extensions/MapTemplateExtensionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.containsKey('foo')}::{map.empty}::{map.get('foo')}"), | ||
"templates/map.html")); | ||
|
||
@Test | ||
public void testMap() { | ||
assertEquals("1::5::true::false::1", Templates.map(Map.of("foo", 1, "bar", 5)).render()); | ||
} | ||
|
||
@CheckedTemplate(basePath = "") | ||
public static class Templates { | ||
|
||
static native TemplateInstance map(Map<String, Object> map); | ||
} | ||
|
||
} |