File tree 3 files changed +13
-1
lines changed
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree
utbot-framework-api/src/main/kotlin/org/utbot/framework
utbot-framework-test/src/test/kotlin/org/utbot/examples/codegen
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,13 @@ object UtSettings : AbstractSettings(
263
263
*/
264
264
var treatOverflowAsError: Boolean by getBooleanProperty(false )
265
265
266
+ /* *
267
+ * Generate tests that treat assertions as error suits.
268
+ *
269
+ * True by default.
270
+ */
271
+ var treatAssertAsErrorSuit: Boolean by getBooleanProperty(true )
272
+
266
273
/* *
267
274
* Instrument all classes before start
268
275
*/
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ import org.utbot.tests.infrastructure.UtValueTestCaseChecker
5
5
import org.utbot.tests.infrastructure.isException
6
6
import org.utbot.testcheckers.eq
7
7
8
- class JavaAssertTest : UtValueTestCaseChecker (testClass = JavaAssert : :class){
8
+ class JavaAssertTest : UtValueTestCaseChecker (
9
+ testClass = JavaAssert : :class,
10
+ testCodeGeneration = false
11
+ ) {
9
12
@Test
10
13
fun testAssertPositive () {
11
14
checkWithException(
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ import org.utbot.summary.SummarySentenceConstants.TAB
144
144
import java.lang.reflect.InvocationTargetException
145
145
import java.security.AccessControlException
146
146
import java.lang.reflect.ParameterizedType
147
+ import org.utbot.framework.UtSettings
147
148
148
149
private const val DEEP_EQUALS_MAX_DEPTH = 5 // TODO move it to plugin settings?
149
150
@@ -361,6 +362,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
361
362
if (exception is AccessControlException ) return false
362
363
// tests with timeout or crash should be processed differently
363
364
if (exception is TimeoutException || exception is ConcreteExecutionFailureException ) return false
365
+ if (UtSettings .treatAssertAsErrorSuit && exception is AssertionError ) return false
364
366
365
367
val exceptionRequiresAssert = exception !is RuntimeException || runtimeExceptionTestsBehaviour == PASS
366
368
val exceptionIsExplicit = execution.result is UtExplicitlyThrownException
You can’t perform that action at this time.
0 commit comments