我需要将以下Eclipse模板移植到IntelliJ IDEA
/**
* See method name.
*/
@${testType:newType(org.junit.Test)}
public void should${testdesc}() {
// given ${cursor}
${staticImport:importStatic('org.hamcrest.Matchers.*', 'org.junit.Assert.*', 'org.mockito.BDDMockito.*')}
// when
// then
}
到目前为止我得到的是
/**
* See method name.
*/
@org.junit.Test
public void should$EXPR$() {
// given $END$
${staticImport:importStatic('org.hamcrest.Matchers.*', 'org.junit.Assert.*', 'org.mockito.BDDMockito.*')}
// when
// then
}
然后勾选Shorten FQ名称标志.
${staticImport:importStatic()}表达式的IDEA等价物是什么?
解决方法:
您不能只在实时模板中导入静态导入. (您可以使用文件模板,请参阅下文).但是你可以在模板中使用方法.您只需完全限定该类,然后选择“缩短FQ名称”和“尽可能使用静态导入”选项.例如