diff --git a/src/test/java/spoon/test/template/TemplateTest.java b/src/test/java/spoon/test/template/TemplateTest.java index d4dcfacd2df..79e7bbcdacd 100644 --- a/src/test/java/spoon/test/template/TemplateTest.java +++ b/src/test/java/spoon/test/template/TemplateTest.java @@ -44,10 +44,7 @@ import spoon.support.compiler.FileSystemFile; import spoon.support.compiler.FileSystemFolder; import spoon.support.template.Parameters; -import spoon.template.ExpressionTemplate; -import spoon.template.Substitution; -import spoon.template.TemplateMatcher; -import spoon.template.TemplateParameter; +import spoon.template.*; import spoon.test.template.testclasses.AnExpressionTemplate; import spoon.test.template.testclasses.AnotherFieldAccessTemplate; import spoon.test.template.testclasses.ArrayAccessTemplate; @@ -442,6 +439,20 @@ public void testCheckBoundTemplate() throws Exception { assertEquals(injectedCode, method.getBody().getStatement(0)); } + @Test + public void testAbstractTemplateIsWellFormed() { + // contract: IsWellFormed method of AbstractTemplate class returns false if there are zero template parameter + + AbstractTemplate zeroParameterTemplate = new AbstractTemplate() { + @Override + public CtElement apply(CtType targetType) { + return null; + } + }; + + assertFalse(zeroParameterTemplate.isWellFormed()); + } + @Test public void testTemplateMatcher() throws Exception { // contract: the given templates should match the expected elements