diff --git a/test/mocks/stream_info/mocks.cc b/test/mocks/stream_info/mocks.cc index 45abe90b33e8..a35582ea6b1e 100644 --- a/test/mocks/stream_info/mocks.cc +++ b/test/mocks/stream_info/mocks.cc @@ -103,7 +103,9 @@ MockStreamInfo::MockStreamInfo() ON_CALL(*this, dynamicMetadata()).WillByDefault(ReturnRef(metadata_)); ON_CALL(Const(*this), dynamicMetadata()).WillByDefault(ReturnRef(metadata_)); ON_CALL(*this, filterState()).WillByDefault(ReturnRef(filter_state_)); - ON_CALL(Const(*this), filterState()).WillByDefault(ReturnRef(*filter_state_)); + ON_CALL(Const(*this), filterState()).WillByDefault(Invoke([this]() -> const FilterState& { + return *filter_state_; + })); ON_CALL(*this, upstreamFilterState()).WillByDefault(ReturnRef(upstream_filter_state_)); ON_CALL(*this, setUpstreamFilterState(_)) .WillByDefault(Invoke([this](const FilterStateSharedPtr& filter_state) {