Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update templates.xml #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 112 additions & 1 deletion tools/src/main/resources/intellij/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,115 @@
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
</templateSet>
</templateSet>
<templateSet group="OpenMRS">
<template name="test" value="@org.junit.Test&#10;public void $SHOULD_SENTENCE$() {&#10;&#9;&#10;&#9;$BODY$&#10;}" description="OpenMRS Style JUnit 4 Test" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="SHOULD_SENTENCE" expression="" defaultValue="&quot;should&quot;" alwaysStopAt="true" />
<variable name="BODY" expression="" defaultValue="&quot;org.junit.Assert.fail(\&quot;not yet implemented\&quot;);&quot;" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="beforeTest" value="@org.junit.Before&#10;public void setUp() {&#10;&#9;$BODY$&#10;}" description="OpenMRS Style JUnit 4 Test Before" toReformat="true" toShortenFQNames="true">
<variable name="BODY" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="logger" value="$ACCESS$ static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger($CLASS$.class);" description="declare static Logger field using slf4j" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="ACCESS" expression="" defaultValue="&quot;private&quot;" alwaysStopAt="true" />
<variable name="CLASS" expression="className()" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="logi" value="$LOGGER$.info(&quot;$MESSAGE$&quot;);" description="log an INFO message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="logw" value="$LOGGER$.warn(&quot;$MESSAGE$&quot;);" description="log a WARN message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="logd" value="$LOGGER$.debug(&quot;$MESSAGE$&quot;);" description="log a DEBUG message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="loge" value="$LOGGER$.error(&quot;$MESSAGE$&quot;);" description="log an ERROR message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="logpe" value="$LOGGER$.error(&quot;$MESSAGE$&quot;, $ERROR$);" description="log a parametrized ERROR message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="ERROR" expression="variableOfType(&quot;java.lang.Throwable&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="logpi" value="$LOGGER$.info(&quot;$MESSAGE$&quot;, $PARAM$);" description="log a parametrized INFO message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="PARAM" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="logpd" value="$LOGGER$.debug(&quot;$MESSAGE$&quot;, $PARAM$);" description="log a parametrized DEBUG message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="PARAM" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="logpw" value="$LOGGER$.warn(&quot;$MESSAGE$&quot;, $PARAM$);" description="log a parametrized WARN message using slf4j logger declared in this class" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="LOGGER" expression="variableOfType(&quot;org.slf4j.Logger&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="PARAM" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="testException" value="@org.junit.Test&#10;public void $SHOULD_FAIL_SENTENCE$() {&#10;&#9;&#10;&#9;org.junit.Assert.assertThrows($EXCEPTION$, () -&gt; $BODY$);&#10;}" description="OpenMRS Style JUnit 4 Test for exception" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="SHOULD_FAIL_SENTENCE" expression="" defaultValue="&quot;shouldFailGiven&quot;" alwaysStopAt="true" />
<variable name="EXCEPTION" expression="" defaultValue="&quot;IllegalArgumentException.class&quot;" alwaysStopAt="true" />
<variable name="BODY" expression="" defaultValue="&quot;{}&quot;" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="beforeTest5" value="@org.junit.jupiter.api.BeforeEach&#10;public void setUp() {&#10;&#9;$BODY$&#10;}" description="OpenMRS Style JUnit 5 Test Before" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="BODY" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="test5" value="@org.junit.jupiter.api.Test&#10;public void $SHOULD_SENTENCE$() {&#10;&#9;&#10;&#9;$BODY$&#10;}" description="OpenMRS Style JUnit 5 Test" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="SHOULD_SENTENCE" expression="" defaultValue="&quot;should&quot;" alwaysStopAt="true" />
<variable name="BODY" expression="" defaultValue="&quot;org.junit.jupiter.api.Assertions.fail(\&quot;not yet implemented\&quot;);&quot;" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="testException5" value="@org.junit.jupiter.api.Test&#10;public void $SHOULD_FAIL_SENTENCE$() {&#10;&#10;&#9;org.junit.jupiter.api.Assertions.assertThrows($EXCEPTION$, () -&gt; $BODY$);&#10;}" description="OpenMRS Style JUnit 5 Test for exception" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="SHOULD_FAIL_SENTENCE" expression="" defaultValue="&quot;shouldFailGiven&quot;" alwaysStopAt="true" />
<variable name="EXCEPTION" expression="" defaultValue="&quot;IllegalArgumentException.class&quot;" alwaysStopAt="true" />
<variable name="BODY" expression="" defaultValue="&quot;{}&quot;" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
</templateSet>