[英]using java annotations in rythm template engine
为了使JUnit测试成为我们使用Ryhtm的一部分,我们提出了以下代码段。 一切顺利,直到我们添加
@Test
这显然是一个Java注释,并使用@标记作为语法元素,Rythm也在使用它。 如何获得@annotation的预期效果? 只是转义@@不起作用,它给出了一个
Syntax error on token "@", delete this token
错误。 那么如何使用Java @批注 ?
我也将其作为错误报告提交到https://github.com/greenlaw110/Rythm/issues/285
@// This is a rythm template
@import static org.junit.Assert.*
@import org.junit.Test.*
@def static {
class TestMe {
String name;
@Test
public void testMe() {
name="test";
assertEquals("test",name);
}
}
}
@{
TestMe testme=new TestMe();
testme.name="testme";
}
The TestMe has the name @(testme.name)
如果您使用完全合格的注释,则它应该起作用:
@org.junit.Test
模板代码中的@import org.junit.Test.*
应该是@import org.junit.Test
,请注意.*
需要@import org.junit.Test
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.