File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
utbot-framework-api/src/main/kotlin/org/utbot/framework
utbot-framework-test/src/test/kotlin/org/utbot/examples/codegen
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,13 @@ object UtSettings : AbstractSettings(
263263 */
264264 var treatOverflowAsError: Boolean by getBooleanProperty(false )
265265
266+ /* *
267+ * Generate tests that treat assertions as error suits.
268+ *
269+ * True by default.
270+ */
271+ var treatAssertAsErrorSuit: Boolean by getBooleanProperty(true )
272+
266273 /* *
267274 * Instrument all classes before start
268275 */
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ import org.utbot.tests.infrastructure.UtValueTestCaseChecker
55import org.utbot.tests.infrastructure.isException
66import org.utbot.testcheckers.eq
77
8- class JavaAssertTest : UtValueTestCaseChecker (testClass = JavaAssert : :class){
8+ class JavaAssertTest : UtValueTestCaseChecker (
9+ testClass = JavaAssert : :class,
10+ testCodeGeneration = false
11+ ) {
912 @Test
1013 fun testAssertPositive () {
1114 checkWithException(
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ import org.utbot.summary.SummarySentenceConstants.TAB
144144import java.lang.reflect.InvocationTargetException
145145import java.security.AccessControlException
146146import java.lang.reflect.ParameterizedType
147+ import org.utbot.framework.UtSettings
147148
148149private const val DEEP_EQUALS_MAX_DEPTH = 5 // TODO move it to plugin settings?
149150
@@ -361,6 +362,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
361362 if (exception is AccessControlException ) return false
362363 // tests with timeout or crash should be processed differently
363364 if (exception is TimeoutException || exception is ConcreteExecutionFailureException ) return false
365+ if (UtSettings .treatAssertAsErrorSuit && exception is AssertionError ) return false
364366
365367 val exceptionRequiresAssert = exception !is RuntimeException || runtimeExceptionTestsBehaviour == PASS
366368 val exceptionIsExplicit = execution.result is UtExplicitlyThrownException
You can’t perform that action at this time.
0 commit comments