-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
NamespaceTemplateExtensionValidationFailureTest.java
56 lines (46 loc) · 1.94 KB
/
NamespaceTemplateExtensionValidationFailureTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package io.quarkus.qute.deployment.extensions;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import io.quarkus.qute.TemplateException;
import io.quarkus.qute.TemplateExtension;
import io.quarkus.test.QuarkusUnitTest;
public class NamespaceTemplateExtensionValidationFailureTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addAsResource(new StringAsset(
"{bro:surname}\n"
+ "{bro:name.bubu}"),
"templates/foo.html")
.addClasses(SomeExtensions.class))
.assertException(t -> {
Throwable e = t;
TemplateException te = null;
while (e != null) {
if (e instanceof TemplateException) {
te = (TemplateException) e;
break;
}
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found incorrect expressions (2)"), te.getMessage());
assertTrue(te.getMessage().contains("No matching namespace [bro] extension method found"), te.getMessage());
assertTrue(te.getMessage().contains("Property/method [bubu] not found on class [java.lang.String]"),
te.getMessage());
});
@Test
public void test() {
fail();
}
@TemplateExtension(namespace = "bro")
public static class SomeExtensions {
static String name() {
return "bubu";
}
}
}