@@ -231,8 +231,10 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
231
231
val fieldAccessible = field.isAccessibleFrom(testClassPackageName)
232
232
233
233
// prevValue is nullable if not accessible because of getStaticFieldValue(..) : Any?
234
- val prevValue = newVar(CgClassId (field.type, isNullable = ! fieldAccessible),
235
- " prev${field.name.capitalize()} " ) {
234
+ val prevValue = newVar(
235
+ CgClassId (field.type, isNullable = ! fieldAccessible),
236
+ " prev${field.name.capitalize()} "
237
+ ) {
236
238
if (fieldAccessible) {
237
239
declaringClass[field]
238
240
} else {
@@ -1072,7 +1074,8 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1072
1074
ParametrizedTestSource .DO_NOT_PARAMETRIZE ->
1073
1075
currentBlock = currentBlock.addAll(generateDeepEqualsAssertion(expected, actual))
1074
1076
ParametrizedTestSource .PARAMETRIZE -> {
1075
- val assertNullStmt = listOf (testFrameworkManager.assertions[testFramework.assertNull](actual).toStatement())
1077
+ val assertNullStmt =
1078
+ listOf (testFrameworkManager.assertions[testFramework.assertNull](actual).toStatement())
1076
1079
currentBlock = currentBlock.add(
1077
1080
CgIfStatement (
1078
1081
CgEqualTo (expected, nullLiteral()),
@@ -1198,7 +1201,8 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1198
1201
it.variableName,
1199
1202
// guard initializer to reuse typecast creation logic
1200
1203
initializer = guardExpression(varType, nullLiteral()).expression,
1201
- isMutable = true )
1204
+ isMutable = true
1205
+ )
1202
1206
}
1203
1207
+ tryWithMocksFinallyClosing
1204
1208
}
@@ -1253,10 +1257,16 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1253
1257
}
1254
1258
val method = currentExecutable as MethodId
1255
1259
val containsFailureExecution = containsFailureExecution(testSet)
1256
- if (method.returnType != voidClassId) {
1260
+
1261
+ val expectedResultClassIdType = when {
1262
+ method.returnType.isPrivate && ! method.returnType.isPublic -> objectClassId
1263
+ else -> method.returnType
1264
+ }
1265
+
1266
+ if (expectedResultClassIdType != voidClassId) {
1257
1267
testArguments + = CgParameterDeclaration (
1258
- expectedResultVarName, resultClassId(method.returnType ),
1259
- isReferenceType = containsFailureExecution || ! method.returnType .isPrimitive
1268
+ expectedResultVarName, resultClassId(expectedResultClassIdType ),
1269
+ isReferenceType = containsFailureExecution || ! expectedResultClassIdType .isPrimitive
1260
1270
)
1261
1271
}
1262
1272
if (containsFailureExecution) {
@@ -1676,7 +1686,10 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1676
1686
val pureJvmReportPath = jvmReportPath.substringAfter(" # " )
1677
1687
1678
1688
// \n is here because IntellijIdea cannot process other separators
1679
- return PathUtil .toHtmlLinkTag(PathUtil .replaceSeparator(pureJvmReportPath), fileName = " JVM crash report" ) + " \n "
1689
+ return PathUtil .toHtmlLinkTag(
1690
+ PathUtil .replaceSeparator(pureJvmReportPath),
1691
+ fileName = " JVM crash report"
1692
+ ) + " \n "
1680
1693
}
1681
1694
1682
1695
private fun UtConcreteExecutionFailure.extractJvmReportPathOrNull (): String? =
0 commit comments