- Add a
custom.xml
file to:
- Windows: <your_user_home_directory>.IntelliJ IDEA<version_number>\config\templates
- Linux: ~IntelliJ IDEA/config/templates
- macOS: ~/Library/Preferences/IntelliJ IDEA/templates
- Add the content (next snippet)
- Restart IntelliJ
<templateSet group="custom"> | |
<template name="mock" value="private final $CLASS$ $CAMELCASE_CLASS$ = org.mockito.Mockito.mock($CLASS$.class);" description="private final mock" toReformat="false" toShortenFQNames="true" useStaticImport="true"> | |
<variable name="CLASS" expression="classNameComplete()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="CAMELCASE_CLASS" expression="camelCase(CLASS)" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
</templateSet> |