Skip to content

Commit ab1a302

Browse files
authored
Removed from legal method names the call of the static initializer (#1358)
* Excluded a method name of static initializer * Added test for the found bug
1 parent 2f54e9f commit ab1a302

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package math
2+
3+
import examples.CustomJavaDocTagsEnabler
4+
import examples.SummaryTestCaseGeneratorTest
5+
import guava.examples.math.IntMath
6+
import org.junit.jupiter.api.Test
7+
import org.junit.jupiter.api.extension.ExtendWith
8+
import org.utbot.framework.plugin.api.MockStrategyApi
9+
import org.utbot.framework.plugin.api.UtClusterInfo
10+
import org.utbot.testing.DoNotCalculate
11+
12+
@ExtendWith(CustomJavaDocTagsEnabler::class)
13+
class SummaryIntMathLogTest : SummaryTestCaseGeneratorTest(
14+
IntMath::class,
15+
) {
16+
@Test
17+
fun testLog2() {
18+
val summary1 = "@utbot.classUnderTest {@link IntMath}\n" +
19+
"@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n"
20+
val summary2 = "@utbot.classUnderTest {@link IntMath}\n" +
21+
"@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n"
22+
val summary3 = "@utbot.classUnderTest {@link IntMath}\n" +
23+
"@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n"
24+
val summary4 = "@utbot.classUnderTest {@link IntMath}\n" +
25+
"@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n" +
26+
"@utbot.invokes {@link java.math.RoundingMode#ordinal()}\n" +
27+
"@utbot.throwsException {@link java.lang.NullPointerException} in: mode"
28+
29+
val methodName1 = "testLog2"
30+
val methodName2 = "testLog2_1"
31+
val methodName3 = "testLog2_2"
32+
val methodName4 = "testLog2_RoundingModeOrdinal"
33+
34+
val displayName1 = ""
35+
val displayName2 = ""
36+
val displayName3 = ""
37+
val displayName4 = "switch(mode) case: -> ThrowNullPointerException"
38+
39+
val summaryKeys = listOf(
40+
summary1,
41+
summary2,
42+
summary3,
43+
summary4
44+
)
45+
46+
val displayNames = listOf(
47+
displayName1,
48+
displayName2,
49+
displayName3,
50+
displayName4
51+
)
52+
53+
val methodNames = listOf(
54+
methodName1,
55+
methodName2,
56+
methodName3,
57+
methodName4
58+
)
59+
60+
val clusterInfo = listOf(
61+
Pair(UtClusterInfo("SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method log2(int, java.math.RoundingMode)", null), 3),
62+
Pair(UtClusterInfo("SYMBOLIC EXECUTION: ERROR SUITE for method log2(int, java.math.RoundingMode)", null), 1)
63+
)
64+
65+
val method = IntMath::log2
66+
val mockStrategy = MockStrategyApi.NO_MOCKS
67+
val coverage = DoNotCalculate
68+
69+
summaryCheck(method, mockStrategy, coverage, summaryKeys, methodNames, displayNames, clusterInfo)
70+
}
71+
}

utbot-summary-tests/src/test/kotlin/math/SummaryIntMathTest.kt renamed to utbot-summary-tests/src/test/kotlin/math/SummaryIntMathPowTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test
66
import org.utbot.framework.plugin.api.MockStrategyApi
77
import org.utbot.framework.plugin.api.UtClusterInfo
88
import org.utbot.testing.DoNotCalculate
9-
class SummaryIntMathTest : SummaryTestCaseGeneratorTest(
9+
class SummaryIntMathPowTest : SummaryTestCaseGeneratorTest(
1010
IntMath::class,
1111
) {
1212
@Test

utbot-summary/src/main/kotlin/org/utbot/summary/comment/SentenceUtil.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ val nextSynonyms = arrayOf(
9393

9494
val skipInvokes = arrayOf(
9595
"<init>",
96+
"<clinit>",
9697
"valueOf",
9798
"getClass"
9899
)

0 commit comments

Comments
 (0)