Skip to content

Commit a9bbba9

Browse files
committed
Added a test
1 parent 3be20f3 commit a9bbba9

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

utbot-sample/src/main/java/org/utbot/examples/unsafe/UnsafeWithField.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
public class UnsafeWithField {
66
Field field;
77

8-
Field setField(Field f) {
8+
public Field setField(Field f) {
99
field = f;
1010
return Field.INTEGER;
1111
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package examples.unsafe
2+
3+
import examples.CustomJavaDocTagsEnabler
4+
import examples.SummaryTestCaseGeneratorTest
5+
import org.junit.jupiter.api.Test
6+
import org.junit.jupiter.api.extension.ExtendWith
7+
import org.utbot.examples.unsafe.UnsafeWithField
8+
import org.utbot.framework.plugin.api.MockStrategyApi
9+
import org.utbot.tests.infrastructure.DoNotCalculate
10+
11+
@ExtendWith(CustomJavaDocTagsEnabler::class)
12+
class UnsafeWithFieldTest : SummaryTestCaseGeneratorTest(
13+
UnsafeWithField::class
14+
) {
15+
@Test
16+
fun testUnsafeWithField() {
17+
val summary1 = "@utbot.classUnderTest {@link UnsafeWithField}\n" +
18+
"@utbot.methodUnderTest {@link org.utbot.examples.unsafe.UnsafeWithField#setField(java.text.NumberFormat.Field)}\n" +
19+
"@utbot.returnsFrom {@code return Field.INTEGER;}"
20+
21+
val methodName1 = "testSetField_ReturnFieldINTEGER"
22+
23+
val displayName1 = "-> return Field.INTEGER"
24+
25+
val summaryKeys = listOf(
26+
summary1
27+
)
28+
29+
val displayNames = listOf(
30+
displayName1
31+
)
32+
33+
val methodNames = listOf(
34+
methodName1
35+
)
36+
37+
val method = UnsafeWithField::setField
38+
val mockStrategy = MockStrategyApi.NO_MOCKS
39+
val coverage = DoNotCalculate
40+
41+
summaryCheck(method, mockStrategy, coverage, summaryKeys, methodNames, displayNames)
42+
}
43+
}

0 commit comments

Comments
 (0)