From 38e6ca9b35ca30ff57da70f7197a40df17659e90 Mon Sep 17 00:00:00 2001 From: Andreas Rauschert <andreas.rb.rauschert@bmw.de> Date: Thu, 8 May 2025 12:24:51 +0200 Subject: [PATCH] Fix TestUtils - Remove move of ego properties to mock_vehicle because then it's invalid and cannot be used for the ON_CALL Matcher anymore --- engine/tests/TestUtils.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/tests/TestUtils.h b/engine/tests/TestUtils.h index 413afd08..b7388318 100644 --- a/engine/tests/TestUtils.h +++ b/engine/tests/TestUtils.h @@ -368,7 +368,7 @@ protected: void SetUp() override { OpenScenarioEngineLibraryTestBase::SetUp(); - mock_vehicle_ = std::make_shared<mantle_api::MockVehicle>(); + fake_vehicle_ = std::make_shared<FakeVehicle>(); mantle_api::VehicleProperties ego_properties{}; ego_properties.type = mantle_api::EntityType::kVehicle; @@ -392,16 +392,15 @@ protected: ego_properties.rear_axle.track_width = 1.68_m; ego_properties.rear_axle.wheel_diameter = 0.8_m; ego_properties.is_host = true; - mock_vehicle_->SetProperties(std::move(std::make_unique<mantle_api::VehicleProperties>(ego_properties))); // Necessary because Create() is always called in engine init and will otherwise not return a MockVehicle ref // which results in an exception ON_CALL(dynamic_cast<mantle_api::MockEntityRepository&>(env_->GetEntityRepository()), Create(testing::_, ego_properties)) - .WillByDefault(testing::Return(mock_vehicle_)); + .WillByDefault(testing::Return(fake_vehicle_)); } - std::shared_ptr<mantle_api::MockVehicle> mock_vehicle_; + std::shared_ptr<FakeVehicle> fake_vehicle_; }; } // namespace testing::OpenScenarioEngine::v1_3 -- GitLab