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 @@ -240,6 +240,13 @@ object UtSettings : AbstractSettings(
240
240
*/
241
241
var treatOverflowAsError: Boolean by getBooleanProperty(false )
242
242
243
+ /* *
244
+ * Generate tests that treat assertions as error suits.
245
+ *
246
+ * True by default.
247
+ */
248
+ var treatAssertAsErrorSuit: Boolean by getBooleanProperty(true )
249
+
243
250
/* *
244
251
* Instrument all classes before start
245
252
*/
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 @@ -113,6 +113,7 @@ import org.utbot.summary.SummarySentenceConstants.TAB
113
113
import java.lang.reflect.InvocationTargetException
114
114
import java.security.AccessControlException
115
115
import java.lang.reflect.ParameterizedType
116
+ import org.utbot.framework.UtSettings
116
117
117
118
private const val DEEP_EQUALS_MAX_DEPTH = 5 // TODO move it to plugin settings?
118
119
@@ -329,6 +330,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
329
330
if (exception is AccessControlException ) return false
330
331
// tests with timeout or crash should be processed differently
331
332
if (exception is TimeoutException || exception is ConcreteExecutionFailureException ) return false
333
+ if (UtSettings .treatAssertAsErrorSuit && exception is AssertionError ) return false
332
334
333
335
val exceptionRequiresAssert = exception !is RuntimeException || runtimeExceptionTestsBehaviour == PASS
334
336
val exceptionIsExplicit = execution.result is UtExplicitlyThrownException
You can’t perform that action at this time.
0 commit comments