By default when I generate test class in IDEA it has "Test" suffix. As I usually use Spock I want to change it to be "Spec" by default. Is it somehow possible?
From the context menu, select Refactor | Rename ( Shift+F6 ). In the popup that opens, select what you want to rename. If you have a module with one content root, and it has the same name as your module, you can rename them both simultaneously. In the Rename <name> dialog that opens, add the new name and click OK.
In your production code in the editor, place the caret at the class for which you want to create a test, press Alt+Enter , and select Create Test. In the Create Test dialog, select the library that you want to use. If you don't have the necessary library yet, you will be prompted to download it. To do that, click Fix.
You can use ⇧⌘T (macOS), or Ctrl+Shift+T (Windows/Linux), to navigate to a test class and back again.
It's finally possible with the IntelliJ 2018.1:
With the IntelliJ IDEA 2018.1, you can customize a test class template and create a test class with Test as a prefix. Go to Preferences | Editor | Code Style | Java | Code Generation, and choose how the test class name should be generated. By default, the IDE creates a test class with the Test as a suffix.
Above is from this blog post
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