Skip to content
Snippets Groups Projects
Commit 38e6ca9b authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

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
parent bbfcac9b
No related branches found
No related tags found
No related merge requests found
Pipeline #72359 failed
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment