Skip to content

Commit

Permalink
Qute type-safe templates - fix interfaces validation
Browse files Browse the repository at this point in the history
- resolves quarkusio#7843
  • Loading branch information
mkouba authored and viniciusfcf committed Jun 16, 2020
1 parent 8b5a936 commit ec15c9b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ private AnnotationTarget findProperty(String name, ClassInfo clazz, IndexView in
}
}
DotName superName = clazz.superName();
if (superName == null || DotNames.OBJECT.equals(superName)) {
if (superName == null) {
clazz = null;
} else {
clazz = index.getClassByName(clazz.superName());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.quarkus.qute.deployment.typesafe;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Collections;

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 InterfaceValidationSuccessTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(Movie.class, MovieExtensions.class)
.addAsResource(new StringAsset("{@java.util.List list}"
+ "{list.empty}:{list.toString}"),
"templates/list.html"));

@Inject
Template list;

@Test
public void testResult() {
assertEquals("true:[]", list.data("list", Collections.emptyList()).render());
}

}

0 comments on commit ec15c9b

Please sign in to comment.