views:

362

answers:

2

Hello! I am migrating my Junit tests from Junit v3 to Junit v4.

I was hoping to use the search and replace structurally "srs" to add an @Test annotation before all methods starting with test.* using my favorite IDE Intellij.

I just cant figura out how to do it... I can create a query that will find all methods without an annotation (there is an example bundled in Intellij) but when used to do a replace either my class gets replaced by only the method names OR nothing is found.

Maybe a regexp is easier :-)

/Konstantin

+1  A: 

Open Search -> Replace in path
Set Directory to the directory where your test is placed
Set search string to: public void test.
Set replace string to: @Test\n\tpublic void test.
Check Regular Expression box.

Enjoy.

Bogdan Gusiev
Sorry not really the answer I was looking for. I was asking for the more powerful structural search. I have already done the replace using regexps.
Konstantin
Did this answer solve the problem?
Arne Evertsson
+1  A: 

It is not possible as of now (but there are requests for class members replacements) There is some useful link for getting started with ssr http://www.jetbrains.com/idea/documentation/ssr.html

nicity