Intellij Structural 仅用 Exception 替换`throws An Exception, TwoException`

Intellij Structurally replace `thows OneException, TwoException` with only Exception

我想用 IntelliJ's s Structural Search and Replace 替换以下代码段:

@Test
public void myTest() throws ExecutionException, InterruptedException {}

与:

@Test
public void myTest() throws Exception {}

目标是稍微简化测试。如何配置文本约束以进行替换?

您还需要将@Test 注释添加到模板。搜索模板将变为:

@Test
$ReturnType$ $Method$($ParameterType$ $Parameter$) throws $ExceptionType$;

替换模板:

@Test
$ReturnType$ $Method$($ParameterType$ $Parameter$) throws Exception;

限制条件:

$Parameter$ min/max [0,unlimited]
$ExceptionType$ min/max [0,unlimited]