Skip to content

Commit

Permalink
Use assertSame instead of deepEquals if expected is a mock
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorkaKulikov committed Oct 3, 2023
1 parent 8e30c4c commit 6626808
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,12 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte
if (!successfullyConstructedCustomAssert) {
val expectedVariable = variableConstructor.getOrCreateVariable(expected, expectedVariableName)
if (emptyLineIfNeeded) emptyLineIfNeeded()
assertEquality(expectedVariable, actual)

if (expected.isMockModel()) {
testFrameworkManager.assertSame(expectedVariable, actual)
} else {
assertEquality(expectedVariable, actual)
}
}
}

Expand Down Expand Up @@ -1303,13 +1308,6 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte
}
}
else -> {
currentExecution!!.result.onSuccess { resultModel ->
if (resultModel.isMockModel()) {
testFrameworkManager.assertSame(expected, actual)
return
}
}

when (expected) {
is CgLiteral -> testFrameworkManager.assertEquals(expected, actual)
is CgNotNullAssertion -> generateForNotNullAssertion(expected, actual)
Expand Down

0 comments on commit 6626808

Please sign in to comment.