TEST_F(ZstdDecompressorImplTest, IllegalConfig) {
  envoy::extensions::compression::zstd::decompressor::v3::Zstd zstd;
  Zstd::Decompressor::ZstdDecompressorLibraryFactory lib_factory;
  NiceMock<Server::Configuration::MockFactoryContext> mock_context;
  std::string json;

  json = R"EOF({
  "chunk_size": 4096,
  "dictionaries": [
    {
      "inline_string": ""
    }
  ]
})EOF";
  TestUtility::loadFromJson(json, zstd);
  EXPECT_THROW_WITH_MESSAGE(lib_factory.createDecompressorFactoryFromProto(zstd, mock_context),
                            EnvoyException, "DataSource cannot be empty");

  json = R"EOF({
  "chunk_size": 4096,
  "dictionaries": [
    {
      "inline_string": "456789"
    }
  ]
})EOF";
  TestUtility::loadFromJson(json, zstd);
  EXPECT_DEATH({ lib_factory.createDecompressorFactoryFromProto(zstd, mock_context); },
               "assert failure: id != 0. Details: Illegal Zstd dictionary");
}
TEST_F(ZstdDecompressorImplTest, IllegalConfig) {
  envoy::extensions::compression::zstd::decompressor::v3::Zstd zstd;
  Zstd::Decompressor::ZstdDecompressorLibraryFactory lib_factory;
  NiceMock<Server::Configuration::MockFactoryContext> mock_context;
  std::string json;

  json = R"EOF({
  "chunk_size": 4096,
  "dictionaries": [
    {
      "inline_string": ""
    }
  ]
})EOF";
  TestUtility::loadFromJson(json, zstd);
  EXPECT_THROW_WITH_MESSAGE(lib_factory.createDecompressorFactoryFromProto(zstd, mock_context),
                            EnvoyException, "DataSource cannot be empty");

  json = R"EOF({
  "chunk_size": 4096,
  "dictionaries": [
    {
      "inline_string": "456789"
    }
  ]
})EOF";
  TestUtility::loadFromJson(json, zstd);
  EXPECT_DEATH({ lib_factory.createDecompressorFactoryFromProto(zstd, mock_context); },
               "assert failure: id != 0. Details: Illegal Zstd dictionary");
}