- _test (Add new Java test with Assertj)
<template name="_test" value="@Test public void $TEST_NAME$ () { //GIVEN //WHEN //THEN org.assertj.core.api.Assertions.assertThat($ASSERT$).isEqualTo($RESULT_EQUAL$); }" description="Add new Java test with Assertj" toReformat="false" toShortenFQNames="true" useStaticImport="true">
<variable name="TEST_NAME" expression="snakeCase(String)" defaultValue=""dummy"" alwaysStopAt="true" />
<variable name="ASSERT" expression="snakeCase(String)" defaultValue=""false"" alwaysStopAt="true" />
<variable name="RESULT_EQUAL" expression="snakeCase(String)" defaultValue=""true"" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
</context>
</template>
- _test_exception (Add new Java exception test with JUnit5)
<template name="_test_exception" value="@Test public void $TEST_NAME$ () { //GIVEN //WHEN //THEN org.junit.jupiter.api.Assertions.assertThrows(NumberFormatException.class, () -> { Integer.parseInt("One"); }); }" description="Add new Java exception test with JUnit5" toReformat="false" toShortenFQNames="true">
<variable name="TEST_NAME" expression="snakeCase(String)" defaultValue=""dummy"" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
</context>
</template>
- _test_value_object (Add a battery of default test for value objects with JUnit5 and Assertj)
<template name="_test_value_object" value="@Test void generate_a_$CLASSNAME$() { $END$ Assertions.assertThat(true).isEqualTo(false); } @Disabled @Test void not_allow_empty_values() { org.junit.jupiter.api.Assertions.assertThrows(RuntimeException.class, () -> { // TODO add method }); } @Disabled @Test void not_allow_null_values() { org.junit.jupiter.api.Assertions.assertThrows(RuntimeException.class, () -> { // TODO add method }); }" description="Add a battery of default test for value objects with JUnit5 and Assertj" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="CLASSNAME" expression="regularExpression(snakeCase(className()), "_should", "")" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
<option name="JAVA_COMMENT" value="false" />
</context>
</template>
- _test_enum (Add a battery of default test for enum with JUnit5 and Assertj)
<template name="_test_enum" value="private final String VALUE_1 = "VALUE_1"; private final String VALUE_2 = "VALUE_2"; private final String INVALID_$CLASS_NAME_UPPER_SNAKE$ = "INVALID_$CLASS_NAME_UPPER_SNAKE$"; @Test$END$ void only_be_created_with_a_valid_$CLASS_NAME_LOWER_SNAKE$() { org.junit.jupiter.api.Assertions.assertNotNull($OBJECT_NAME$.from(VALUE_1)); org.junit.jupiter.api.Assertions.assertNotNull($OBJECT_NAME$.from(VALUE_2)); } @Disabled @Test void fail_when_$CLASS_NAME_LOWER_SNAKE$_is_invalid() { org.junit.jupiter.api.Assertions.assertThrows(Invalid$OBJECT_NAME$.class, () -> $OBJECT_NAME$.from(INVALID_$CLASS_NAME_UPPER_SNAKE$)); }" description="Add a battery of default test for enum with JUnit5 and Assertj" toReformat="false" toShortenFQNames="true">
<variable name="CLASS_NAME_UPPER_SNAKE" expression="regularExpression(capitalizeAndUnderscore(className()), "_SHOULD", "")" defaultValue="" alwaysStopAt="true" />
<variable name="CLASS_NAME_LOWER_SNAKE" expression="regularExpression(snakeCase(className()), "_should", "")" defaultValue="" alwaysStopAt="true" />
<variable name="OBJECT_NAME" expression="regularExpression(className(), "Should", "")" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
<option name="JAVA_COMMENT" value="false" />
</context>
</template>