Suppose you start with an auto-generated method
public void setKey(Key key) {
this.key = key;
}
And write a test for it
@Test
public void testSetKey()
Then 3 month from now you decide that a more appropriate name for the method would be changeKeyTo
. You refactor your production code and end up with:
public void changeKeyTo(Key key) {
this.key = key;
}
Life is good, however, your test name remained unchanged
@Test
public void testSetKey()
How do you deal with something like this? Can you refactor test code automatically with your production code? Does eclipse allow this?
eclipse would not figure this out to change:
It only changes the references of the method used in other classes or in the same class.
If you really want to make this functionality work, you could extend eclipse's refactoring API as I did for my project and give it this new functionality.
If you like to have any references on this just ask me ;-)
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