Structual Replace should only replace class name


I'm trying to use the "Structual Replace" feature to replace just a class name. See this example:

I'm searching for all classes that extend BaseIntegrationTest and whose name does not end with "IntegrationTest".

Then I want to replace "Test" in the original class name with "IntegrationTest". As search target I selected "SearchClass". So, I'm expecting this result:

public class LoginIntegrationTest extends BaseIntegrationTest {

public void testLogin() {



But it actually replaces the whole class and the result looks like this:

import org.junit.jupiter.api.Test;


Is this a bug? Or am I doing something wrong?

Thanks in advance

Comment actions Permalink
Official comment

If you select a search target, this refers to the entire construct with that name. In this case the entire class. To get the result you want, replace the entire class, e.g. with a search pattern like this:

class $SearchClass$ extends $Parent$ {

where $content$ count=[0,∞]. Replace pattern:

class $NewClass$ extends $Parent$ {

I hope this helps,


Comment actions Permalink

Nice, this works. I tried the same but forgot count=[0,∞]

Thank you very much!



Please sign in to leave a comment.