I want to perform structural search on my tests to detect all methods that look like tests but are not annotated with @Test.
I tried with this pattern with no success (no matching code found):
@$Annotation$ public void $method$()
$Annotation$ - text like: ^Test$, min occurs: 0, max occurs: 0
$method$ - text like: should|test, min occurs: 1, max occurs: 1
What am I doing wrong?
Seems, you have to try to provide a class with your pattern too, as it's done in templates:
class $Class$ {
@$Annotation$( )
$MethodType$ $MethodName$($ParameterType$ $ParameterName$);
}
Furthermore, you have to change the $method$ variable to something like should.*|test.* to accept not a whole words only.
I've tested it with IntelliJ Idea 15, it's working for the methods like:
public void testSomething() {
}
public void shouldSomething() {
}
only if the $Class$ is provided in search template and the method names regexes contain .* to match any method, which name begins with test or should.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With