From 44ad0a23783da6422690bd0f73e7a16c07a3f19b Mon Sep 17 00:00:00 2001 From: Vicente Mataix Ferrandiz Date: Tue, 17 Dec 2024 10:57:10 +0100 Subject: [PATCH] Refactor test_registry.cpp to use nested namespace Kratos::Testing and add exception expectation for missing sub-item retrieval --- kratos/tests/cpp_tests/sources/test_registry.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kratos/tests/cpp_tests/sources/test_registry.cpp b/kratos/tests/cpp_tests/sources/test_registry.cpp index 06f046345a28..f6c503cf3472 100644 --- a/kratos/tests/cpp_tests/sources/test_registry.cpp +++ b/kratos/tests/cpp_tests/sources/test_registry.cpp @@ -21,9 +21,7 @@ #include "includes/expect.h" #include "includes/registry.h" -namespace Kratos { - -namespace Testing { +namespace Kratos::Testing { namespace { @@ -141,6 +139,7 @@ KRATOS_TEST_CASE_IN_SUITE(RegistrySubValue, KratosCoreFastSuite) registry_item.AddItem("sub_value_item", value); auto& sub_item = registry_item.GetItem("sub_value_item"); + KRATOS_EXPECT_EXCEPTION_IS_THROWN(registry_item.GetItem("sub_value_item_2"), ""); KRATOS_EXPECT_EQ(sub_item.Name(),"sub_value_item"); KRATOS_EXPECT_TRUE(sub_item.HasValue()); @@ -315,5 +314,4 @@ KRATOS_TEST_CASE_IN_SUITE(RegistryIsSameType, KratosCoreFastSuite) { KRATOS_EXPECT_FALSE(Registry::GetItem("variables.all.VELOCITY").IsSameType(test_double)); } -} -} // namespace Kratos. +} // namespace Kratos::Testing.