TEST_F(StreamInfoImplTest, ResponseFlagTest) {
  const std::vector<ResponseFlag> responseFlags = {FailedLocalHealthCheck,
                                                   NoHealthyUpstream,
                                                   UpstreamRequestTimeout,
                                                   LocalReset,
                                                   UpstreamRemoteReset,
                                                   UpstreamConnectionFailure,
                                                   UpstreamConnectionTermination,
                                                   UpstreamOverflow,
                                                   NoRouteFound,
                                                   DelayInjected,
                                                   FaultInjected,
                                                   RateLimited};

  StreamInfoImpl stream_info(Http::Protocol::Http2, test_time_.timeSystem(), nullptr);

  EXPECT_FALSE(stream_info.hasAnyResponseFlag());
  EXPECT_FALSE(stream_info.intersectResponseFlags(0));
  for (ResponseFlag flag : responseFlags) {
    // Test cumulative setting of response flags.
    EXPECT_FALSE(stream_info.hasResponseFlag(flag))
        << fmt::format("Flag: {} was already set", flag);
    stream_info.setResponseFlag(flag);
    EXPECT_TRUE(stream_info.hasResponseFlag(flag))
        << fmt::format("Flag: {} was expected to be set", flag);
  }
  EXPECT_TRUE(stream_info.hasAnyResponseFlag());
  EXPECT_EQ(0xFFF, stream_info.responseFlags());

  StreamInfoImpl stream_info2(Http::Protocol::Http2, test_time_.timeSystem(), nullptr);
  stream_info2.setResponseFlag(FailedLocalHealthCheck);

  EXPECT_TRUE(stream_info2.intersectResponseFlags(FailedLocalHealthCheck));
}
TEST_F(StreamInfoImplTest, ResponseFlagTest) {
  const std::vector<ResponseFlag> responseFlags = {FailedLocalHealthCheck,
                                                   NoHealthyUpstream,
                                                   UpstreamRequestTimeout,
                                                   LocalReset,
                                                   UpstreamRemoteReset,
                                                   UpstreamConnectionFailure,
                                                   UpstreamConnectionTermination,
                                                   UpstreamOverflow,
                                                   NoRouteFound,
                                                   DelayInjected,
                                                   FaultInjected,
                                                   RateLimited};

  StreamInfoImpl stream_info(Http::Protocol::Http2, test_time_.timeSystem(), nullptr);

  EXPECT_FALSE(stream_info.hasAnyResponseFlag());
  EXPECT_FALSE(stream_info.intersectResponseFlags(0));
  for (ResponseFlag flag : responseFlags) {
     
    EXPECT_FALSE(stream_info.hasResponseFlag(flag))
        << fmt::format("Flag: {} was already set", flag);
    stream_info.setResponseFlag(flag);
    EXPECT_TRUE(stream_info.hasResponseFlag(flag))
        << fmt::format("Flag: {} was expected to be set", flag);
  }
  EXPECT_TRUE(stream_info.hasAnyResponseFlag());
  EXPECT_EQ(0xFFF, stream_info.responseFlags());

  StreamInfoImpl stream_info2(Http::Protocol::Http2, test_time_.timeSystem(), nullptr);
  stream_info2.setResponseFlag(FailedLocalHealthCheck);

  EXPECT_TRUE(stream_info2.intersectResponseFlags(FailedLocalHealthCheck));
}