File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
utbot-framework-test/src/test/kotlin/org/utbot/examples/exceptions
utbot-sample/src/main/java/org/utbot/examples/exceptions Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ junit4PlatformVersion=1.9.0
18
18
mockitoVersion =3.5.13
19
19
z3Version =4.8.9.1
20
20
z3JavaApiVersion =4.8.9
21
- sootCommitHash =3adf23c3
21
+ sootCommitHash =ed85c59
22
22
kotlinVersion =1.7.20
23
23
log4j2Version =2.13.3
24
24
coroutinesVersion =1.6.3
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import org.utbot.tests.infrastructure.isException
7
7
import org.utbot.framework.plugin.api.CodegenLanguage
8
8
import org.junit.jupiter.api.Test
9
9
import org.utbot.testcheckers.eq
10
+ import org.utbot.testcheckers.withoutConcrete
10
11
import org.utbot.tests.infrastructure.CodeGeneration
11
12
12
13
internal class ExceptionExamplesTest : UtValueTestCaseChecker (
@@ -106,6 +107,23 @@ internal class ExceptionExamplesTest : UtValueTestCaseChecker(
106
107
)
107
108
}
108
109
110
+ /* *
111
+ * Covers [#656](https://github.com/UnitTestBot/UTBotJava/issues/656).
112
+ */
113
+ @Test
114
+ fun testCatchExceptionAfterOtherPossibleException () {
115
+ withoutConcrete {
116
+ checkWithException(
117
+ ExceptionExamples ::catchExceptionAfterOtherPossibleException,
118
+ eq(3 ),
119
+ { i, r -> i == - 1 && r.isException<ArithmeticException >() },
120
+ { i, r -> i == 0 && r.getOrThrow() == 2 },
121
+ { i, r -> r.getOrThrow() == 1 },
122
+ coverage = atLeast(100 )
123
+ )
124
+ }
125
+ }
126
+
109
127
/* *
110
128
* Used for path generation check in [org.utbot.engine.Traverser.fullPath]
111
129
*/
Original file line number Diff line number Diff line change @@ -86,6 +86,18 @@ public int catchDeepNestedThrow(int i) {
86
86
}
87
87
}
88
88
89
+ public int catchExceptionAfterOtherPossibleException (int i ) {
90
+ int x = 15 ;
91
+ x /= i + 1 ;
92
+
93
+ try {
94
+ x /= i ;
95
+ } catch (RuntimeException e ) {
96
+ return 2 ;
97
+ }
98
+ return 1 ;
99
+ }
100
+
89
101
public IllegalArgumentException createException () {
90
102
return new IllegalArgumentException ("Here we are: " + Math .sqrt (10 ));
91
103
}
You can’t perform that action at this time.
0 commit comments