Can eclipse automatically rename the unit test class when the class under test is renamed?

Viewed 859

I often use the refactor -> rename functionality in eclipse and I also have the habit of naming the associated unit test TestedClassNameTest. But when I rename my tested class I must not forget to rename my unitTest. It would be extremely useful to rename my unit test automatically when the tested class is renamed.

I guess it wouldn't be that difficult to create a plugin that does the job but maybe that isn't even necessary?

3 Answers

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 ;-)

Related