From a9bbba9aea287cbb100a6f9d4fdf893e9adcba8a Mon Sep 17 00:00:00 2001 From: amandelpie Date: Fri, 21 Oct 2022 16:45:13 +0300 Subject: [PATCH] Added a test --- .../examples/unsafe/UnsafeWithField.java | 2 +- .../examples/unsafe/UnsafeWithFieldTest.kt | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 utbot-summary-tests/src/test/kotlin/examples/unsafe/UnsafeWithFieldTest.kt diff --git a/utbot-sample/src/main/java/org/utbot/examples/unsafe/UnsafeWithField.java b/utbot-sample/src/main/java/org/utbot/examples/unsafe/UnsafeWithField.java index bac70b2dcc..83c3bf3df9 100644 --- a/utbot-sample/src/main/java/org/utbot/examples/unsafe/UnsafeWithField.java +++ b/utbot-sample/src/main/java/org/utbot/examples/unsafe/UnsafeWithField.java @@ -5,7 +5,7 @@ public class UnsafeWithField { Field field; - Field setField(Field f) { + public Field setField(Field f) { field = f; return Field.INTEGER; } diff --git a/utbot-summary-tests/src/test/kotlin/examples/unsafe/UnsafeWithFieldTest.kt b/utbot-summary-tests/src/test/kotlin/examples/unsafe/UnsafeWithFieldTest.kt new file mode 100644 index 0000000000..b085657a9a --- /dev/null +++ b/utbot-summary-tests/src/test/kotlin/examples/unsafe/UnsafeWithFieldTest.kt @@ -0,0 +1,43 @@ +package examples.unsafe + +import examples.CustomJavaDocTagsEnabler +import examples.SummaryTestCaseGeneratorTest +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.utbot.examples.unsafe.UnsafeWithField +import org.utbot.framework.plugin.api.MockStrategyApi +import org.utbot.tests.infrastructure.DoNotCalculate + +@ExtendWith(CustomJavaDocTagsEnabler::class) +class UnsafeWithFieldTest : SummaryTestCaseGeneratorTest( + UnsafeWithField::class +) { + @Test + fun testUnsafeWithField() { + val summary1 = "@utbot.classUnderTest {@link UnsafeWithField}\n" + + "@utbot.methodUnderTest {@link org.utbot.examples.unsafe.UnsafeWithField#setField(java.text.NumberFormat.Field)}\n" + + "@utbot.returnsFrom {@code return Field.INTEGER;}" + + val methodName1 = "testSetField_ReturnFieldINTEGER" + + val displayName1 = "-> return Field.INTEGER" + + val summaryKeys = listOf( + summary1 + ) + + val displayNames = listOf( + displayName1 + ) + + val methodNames = listOf( + methodName1 + ) + + val method = UnsafeWithField::setField + val mockStrategy = MockStrategyApi.NO_MOCKS + val coverage = DoNotCalculate + + summaryCheck(method, mockStrategy, coverage, summaryKeys, methodNames, displayNames) + } +} \ No newline at end of file