forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Qute parameter declarations - autoimport java.lang if needed
- resolves quarkusio#20975
- Loading branch information
Showing
3 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
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
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
41 changes: 41 additions & 0 deletions
41
...te/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/TypeSafeJavaLangTest.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,41 @@ | ||
package io.quarkus.qute.deployment.typesafe; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.qute.Template; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class TypeSafeJavaLangTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(Movie.class) | ||
.addAsResource(new StringAsset("{@String movie}" | ||
+ "{@java.util.List<Integer> movies}" | ||
+ "{#if movie.toLowerCase is 'foo'}" | ||
+ "Foo movie!" | ||
+ "{/if}" | ||
+ "::{movies.get(0).intValue}" | ||
+ ""), "templates/foo.html")); | ||
|
||
@Inject | ||
Template foo; | ||
|
||
@Test | ||
public void testValidation() { | ||
assertEquals("Foo movie!::42", | ||
foo.data("movie", "foo", "movies", List.of(42)).render()); | ||
} | ||
|
||
} |