0

With IntelliJ's s Structural Search and Replace I want to replace the following snippet:

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

with:

@Test
public void myTest() throws Exception {}

The goal is to simplify tests a bit. How do I configure the text constraints to do the replacement?

IntelliJ Structural Replace

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68
Joe
  • 3,370
  • 4
  • 33
  • 56

1 Answers1

1

You'll want to add the @Test annotation to the template too. The search template then becomes:

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

Replace template:

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

Constraints:

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

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68