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
1818mockitoVersion =3.5.13
1919z3Version =4.8.9.1
2020z3JavaApiVersion =4.8.9
21- sootCommitHash =3adf23c3
21+ sootCommitHash =ed85c59
2222kotlinVersion =1.7.20
2323log4j2Version =2.13.3
2424coroutinesVersion =1.6.3
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import org.utbot.tests.infrastructure.isException
77import org.utbot.framework.plugin.api.CodegenLanguage
88import org.junit.jupiter.api.Test
99import org.utbot.testcheckers.eq
10+ import org.utbot.testcheckers.withoutConcrete
1011import org.utbot.tests.infrastructure.CodeGeneration
1112
1213internal class ExceptionExamplesTest : UtValueTestCaseChecker (
@@ -106,6 +107,23 @@ internal class ExceptionExamplesTest : UtValueTestCaseChecker(
106107 )
107108 }
108109
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+
109127 /* *
110128 * Used for path generation check in [org.utbot.engine.Traverser.fullPath]
111129 */
Original file line number Diff line number Diff line change @@ -86,6 +86,18 @@ public int catchDeepNestedThrow(int i) {
8686 }
8787 }
8888
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+
89101 public IllegalArgumentException createException () {
90102 return new IllegalArgumentException ("Here we are: " + Math .sqrt (10 ));
91103 }
You can’t perform that action at this time.
0 commit comments