Structural Search and Replace - Unit tests? Follow
Hi all,
I am trying to create a SSR template which will convert all Unit 3 tests to Unit 4 test. I want to do this by removing the extends Testcase, and removing the 'test' prefix from all methods.
This is my source:
and I want to replace this by:
So my question: is it possible? I already have problems removing the 'test' prefix from the method same. I tried defining a new variable, but that doens't seem possible in the 'replace' part...
anyone suggestions?
Please sign in to leave a comment.
Right it isn't possible but please file JIRA item for this
Erik Pragt wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
http://jetbrains.net/jira/browse/IDEA-20103
The YouTrack item http://jetbrains.net/jira/browse/IDEA-20103 is listed as resolved, but I'm not sure how to use it. There is no detail on the issue itself.
I'm in the same position as the original poster (with a little more detail).
I'm trying to convert
public void testFoo() throws ExceptionType {
doSomethingExpectedToThrowException();
///CLOVER:OFF
fail();
///CLOVER:ON
}
to
@Test(expected=ExceptionType.class)
public void foo() throws ExceptionType {
doSomethingExpectedToThrowException();
}
SSR can't seem to replace each individual matching method. It replaces the entire class with a single matching method. I'm also not sure how to achieve the method name mutation as described in the YouTrack item.
This is on IU-90.94.
Cheers.
Brad