Structual Replace should only replace class name
Hi,
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 {
@Test
public void testLogin() {
}
}
But it actually replaces the whole class and the result looks like this:
import org.junit.jupiter.api.Test;
LoginIntegrationTest
Is this a bug? Or am I doing something wrong?
Thanks in advance
Please sign in to leave a 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:
where $content$ count=[0,∞]. Replace pattern:
I hope this helps,
Bas
Nice, this works. I tried the same but forgot count=[0,∞]
Thank you very much!