Last active
February 19, 2024 12:18
-
-
Save seanjreilly/9d943b216f67200dfd78ac9e0f1f5e95 to your computer and use it in GitHub Desktop.
An IntelliJ live template for JUnit5 unit tests in Java.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="JUnit5"> | |
<template name="test" value="@org.junit.jupiter.api.Test @org.junit.jupiter.api.DisplayName("$name$") void $method$() throws Exception { $END$ }" description="JUnit 5 test" toReformat="true" toShortenFQNames="true" useStaticImport="true"> | |
<variable name="name" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="method" expression="camelCase(name)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
</templateSet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A live template for JUnit5 unit tests in Java for IntelliJ. It uses the
@DisplayName
annotation and variables so you don't need to type the method name, just a test name. Installation instructions are here.Once it's installed, type
test
and hit TAB in a Java file.