如何在IntelliJ中自定义单元测试的创建?

时间:2019-07-09 12:14:45

标签: intellij-idea

我喜欢IntelliJ的unit test creation功能,该功能可以为每种要测试的方法生成存根测试方法。是否可以自定义生成的代码?例如,当前IntelliJ将创建以下测试:

'TransferRequestItem' object has no attribute 'close'

例如,是否可以修改某些内容,使其还可以添加默认的构造函数调用?

public class MyClassTest {

    @Test public void getVersion() {
    }
}

我正在使用IntelliJ IDEA Ultimate Edition 2019.1。

1 个答案:

答案 0 :(得分:1)

可以在“设置/首选项|编辑器|文件和代码模板”中更改测试模板:https://blog.codeleak.pl/2013/07/how-to-customize-code-templates-for.html

相关问题