[英]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.