Now question: Could you add an option to configure how test method is named? For instance I'm using BDD style, so for me better is to name method with prefix *should*, for instance:
The example given does not seem relevant: the test method doesn't contain the name of a method under test. MoreUnit's concern regarding method names is to:
a) create a test method from a production method, e.g. myMethod() =>
testMyMethod()
or:
@Test
myMethod()
or:
@Test
testMyMethod()
b) jump to a test method from a production method, when the extended method search is *not* activated (BTW, I think we could make it a default now, and remove the preference...)
That said, a relevant example could be: myMethod() =>
@Test
myMethodShouldDoSomethingWhenSomeCondition()
or:
@Test
myMethod_should_do_something_when_some_condition()
For that case, we could let the user define a pattern, as for the existing preferences: "test${methodUnderTest}", "${methodUnderTest}Should"
As for the example that is given, I would suggest the author to create a template (Preferences > Java > Editor > Templates), for instance:
Name: should
Context: Java type members
Pattern:
@${testType:newType(org.junit.Test)}
public void should${DoSomething}() throws Exception {
${cursor}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The example given does not seem relevant: the test method doesn't contain the name of a method under test. MoreUnit's concern regarding method names is to:
a) create a test method from a production method, e.g. myMethod() =>
testMyMethod()
or:
@Test
myMethod()
or:
@Test
testMyMethod()
b) jump to a test method from a production method, when the extended method search is *not* activated (BTW, I think we could make it a default now, and remove the preference...)
That said, a relevant example could be: myMethod() =>
@Test
myMethodShouldDoSomethingWhenSomeCondition()
or:
@Test
myMethod_should_do_something_when_some_condition()
For that case, we could let the user define a pattern, as for the existing preferences: "test${methodUnderTest}", "${methodUnderTest}Should"
As for the example that is given, I would suggest the author to create a template (Preferences > Java > Editor > Templates), for instance:
Name: should
Context: Java type members
Pattern:
@${testType:newType(org.junit.Test)}
public void should${DoSomething}() throws Exception {
${cursor}
}