test: create `_TemplateStdlibTest` to help test of `tim/stdlib`

This commit is contained in:
The-Lum 2023-09-16 08:26:32 +00:00
parent ec260ff0c9
commit 957726fda0
1 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,59 @@
package net.sourceforge.plantuml.tim.stdlib;
import static net.sourceforge.plantuml.test.JunitUtils.StringJsonConverter;
import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutput;
import static net.sourceforge.plantuml.tim.TimTestUtils.assertTimExpectedOutputFromInput;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
import org.junit.jupiter.api.IndicativeSentencesGeneration;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.converter.ConvertWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.tim.EaterException;
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
import net.sourceforge.plantuml.tim.TFunction;
/**
* Tests the builtin function.
*/
@IndicativeSentencesGeneration(separator = ": ", generator = ReplaceUnderscores.class)
// Change `XXX` by the name of the tim.stdlib Class Under Test
@Disabled
class XXXTest {
TFunction cut = new XXX();
final String cutName = "XXX";
@Test
void Test_without_Param() throws EaterException, EaterExceptionLocated {
assertTimExpectedOutput(cut, "0"); // Change expetected value here
}
@ParameterizedTest(name = "[{index}] " + cutName + "(''{0}'') = {1}")
@CsvSource(nullValues = "null", value = {
" 0, 0", // Put test values here
})
void Test_with_String(String input, String expected) throws EaterException, EaterExceptionLocated {
assertTimExpectedOutputFromInput(cut, input, expected);
}
@ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
@CsvSource(nullValues = "null", value = {
" 0, 0", // Put test values here
})
void Test_with_Integer(Integer input, String expected) throws EaterException, EaterExceptionLocated {
assertTimExpectedOutputFromInput(cut, input, expected);
}
@ParameterizedTest(name = "[{index}] " + cutName + "({0}) = {1}")
@CsvSource(value = {
" 0, 0", // Put test values here
})
void Test_with_Json(@ConvertWith(StringJsonConverter.class) JsonValue input, String expected) throws EaterException, EaterExceptionLocated {
assertTimExpectedOutputFromInput(cut, input, expected);
}
}