1
1
package org.utbot.framework.codegen.model.constructor.tree
2
2
3
3
import org.utbot.common.PathUtil
4
- import org.utbot.common.WorkaroundReason.*
5
4
import org.utbot.common.packageName
6
5
import org.utbot.engine.isStatic
7
6
import org.utbot.framework.codegen.ForceStaticMocking
@@ -24,12 +23,14 @@ import org.utbot.framework.codegen.model.constructor.util.CgStatementConstructor
24
23
import org.utbot.framework.codegen.model.constructor.util.EnvironmentFieldStateCache
25
24
import org.utbot.framework.codegen.model.constructor.util.FieldStateCache
26
25
import org.utbot.framework.codegen.model.constructor.util.classCgClassId
26
+ import org.utbot.framework.codegen.model.constructor.util.needExpectedDeclaration
27
27
import org.utbot.framework.codegen.model.constructor.util.overridesEquals
28
28
import org.utbot.framework.codegen.model.constructor.util.typeCast
29
29
import org.utbot.framework.codegen.model.tree.CgAllocateArray
30
30
import org.utbot.framework.codegen.model.tree.CgAnnotation
31
31
import org.utbot.framework.codegen.model.tree.CgArrayElementAccess
32
32
import org.utbot.framework.codegen.model.tree.CgAssignment
33
+ import org.utbot.framework.codegen.model.tree.CgClassId
33
34
import org.utbot.framework.codegen.model.tree.CgConstructorCall
34
35
import org.utbot.framework.codegen.model.tree.CgDeclaration
35
36
import org.utbot.framework.codegen.model.tree.CgDocPreTagStatement
@@ -95,6 +96,7 @@ import org.utbot.framework.plugin.api.ConstructorId
95
96
import org.utbot.framework.plugin.api.FieldId
96
97
import org.utbot.framework.plugin.api.MethodId
97
98
import org.utbot.framework.plugin.api.TimeoutException
99
+ import org.utbot.framework.plugin.api.TypeParameters
98
100
import org.utbot.framework.plugin.api.UtArrayModel
99
101
import org.utbot.framework.plugin.api.UtAssembleModel
100
102
import org.utbot.framework.plugin.api.UtClassRefModel
@@ -151,11 +153,9 @@ import org.utbot.framework.plugin.api.util.shortWrapperClassId
151
153
import org.utbot.framework.plugin.api.util.stringClassId
152
154
import org.utbot.framework.plugin.api.util.voidClassId
153
155
import org.utbot.framework.util.isUnit
154
- import org.utbot.framework.codegen.model.tree.CgClassId
155
- import org.utbot.framework.plugin.api.TypeParameters
156
+ import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
156
157
import java.lang.reflect.InvocationTargetException
157
158
import kotlin.reflect.jvm.javaType
158
- import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
159
159
160
160
private const val DEEP_EQUALS_MAX_DEPTH = 5 // TODO move it to plugin settings?
161
161
@@ -499,7 +499,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
499
499
500
500
var expected = expected
501
501
if (expected == null ) {
502
- require(! expectedDeclarationIsNeeded (expectedModel))
502
+ require(! needExpectedDeclaration (expectedModel))
503
503
expected = actual
504
504
}
505
505
@@ -852,7 +852,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
852
852
val fieldName = fieldId.name
853
853
var expectedVariable: CgVariable ? = null
854
854
855
- if (expectedDeclarationIsNeeded (fieldModel)) {
855
+ if (needExpectedDeclaration (fieldModel)) {
856
856
val expectedFieldDeclaration = createDeclarationForFieldFromVariable(fieldId, expected, fieldName)
857
857
858
858
statements + = expectedFieldDeclaration
@@ -873,9 +873,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
873
873
statements.addEmptyLineIfNeeded()
874
874
}
875
875
876
- private fun expectedDeclarationIsNeeded (fieldModel : UtModel ) =
877
- ! (fieldModel is UtNullModel || fieldModel is UtPrimitiveModel && fieldModel.value is Boolean )
878
-
879
876
@Suppress(" UNUSED_ANONYMOUS_PARAMETER" )
880
877
private fun createDeclarationForFieldFromVariable (
881
878
fieldId : FieldId ,
@@ -1301,15 +1298,11 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1301
1298
emptyLineIfNeeded()
1302
1299
}
1303
1300
1304
-
1305
1301
// create a block for current test case
1306
1302
parametersStatements + = innerBlock(
1307
1303
{},
1308
- block(executionArgumentsBody) + createArgumentsCallRepresentation(
1309
- execIndex,
1310
- argListVariable,
1311
- arguments
1312
- )
1304
+ block(executionArgumentsBody)
1305
+ + createArgumentsCallRepresentation(execIndex, argListVariable, arguments)
1313
1306
)
1314
1307
}
1315
1308
}
0 commit comments