Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Idea "Move refactoring" with Junit tests

Seems when I make "move" refactoring all my junit tests lays on its old place. Often I tests "package" visible classes, so they becomes invisible, if SUT moves to another package.

Do you move tests by hand?

like image 767
dmitrynikolaev Avatar asked Jul 13 '09 10:07

dmitrynikolaev


1 Answers

I have 4 options for you:

  1. Go to the "Package" view in the left, select both files, and then hit F6. It should move them both to the right place.

  2. Make the class public temporarily, before you do your refactor, and switch back afterwards.

  3. Try moving the test first. I seem to remember that avoids breaking any of the dependencies.

  4. There is a plugin (I think it's toggleTest or unitTest-- I had both of them installed) that patches the Move Refactor to also bring the test with it. Worked great. Unfortunately it looks like these may not work with the latest IDEA.

like image 70
ndp Avatar answered Sep 17 '22 13:09

ndp