From c494adba885c5624d9bbb829e115c9004fc95ac1 Mon Sep 17 00:00:00 2001 From: srikappa Date: Mon, 12 Jul 2021 14:21:04 -0700 Subject: [PATCH] Use a utility function to compare json document and expected string Signed-off-by: srikappa --- .../AzCore/Tests/Serialization/Json/TestCases_Patching.cpp | 5 +---- .../AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp index 046bb88d76..15c3c8f71b 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp @@ -71,10 +71,7 @@ namespace JsonSerializationTests const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{}) { CheckApplyPatchOutcome(target, patch, outcome, processing, settings); - rapidjson::Document expectedPatchedDocument; - expectedPatchedDocument.Parse(expectedPatchedResult); - ASSERT_FALSE(expectedPatchedDocument.HasParseError()); - EXPECT_EQ(AZ::JsonSerialization::Compare(expectedPatchedDocument, *m_jsonDocument), AZ::JsonSerializerCompareResult::Equal); + Expect_DocStrEq(expectedPatchedResult); } void CheckCreatePatch_Core(const char* source, AZStd::string_view patch, const char* target, diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp index 728b95f74b..7d9fb64c96 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp @@ -265,8 +265,8 @@ namespace AzToolsFramework AZ_Error( "Prefab", - result.GetOutcome() != AZ::JsonSerializationResult::Outcomes::PartialSkip && - result.GetOutcome() != AZ::JsonSerializationResult::Outcomes::Success, + result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::PartialSkip || + result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success, "Some of the patches are not successfully applied."); //remove the link id placed into the instance