如何将我的测试方法重写为 xtend?我已经尝试了几件事,但我失败了。
用 xtend 编写的类
import com.google.common.base.Function
class Generator {
@Property Function<Generator, CharSequence> generateSomething;
generateFoo() {
if( null != generateSomething) {
generateSomething.apply(this)
}
}
用Java编写的TestClass
@Test
public void testX() {
Generator gen = createGenerator()
Function<Generator, CharSequence> generateSomething= new Function<Generator, CharSequence>() {
@Override
public CharSequence apply( Generator input ) {
StringConcatenation result = new StringConcatenation();
result.append(".......");
return result;
}
};
gen.setGenerateSomething( generateSomething );
}