MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
test_instance.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2// SPDX-License-Identifier: Apache-2.0
3
4#include <memory>
5#include <stdexcept>
6#include <catch2/catch_test_macros.hpp>
10#include "../../tests/Utils.hpp"
11
12using namespace mxl::lib;
13
14TEST_CASE_PERSISTENT_FIXTURE(mxl::tests::mxlDomainFixture, "Instance : getFlowReader rejects invalid flow ids", "[instance]")
15{
16 auto domainWatcher = std::make_shared<DomainWatcher>(domain);
17 auto flowIoFactory = std::make_unique<PosixFlowIoFactory>(domainWatcher);
18 auto const instance = std::make_shared<Instance>(domain, "", std::move(flowIoFactory), domainWatcher);
19
20 // The C API checks flow ids before calling getFlowReader, but internal callers do not.
21 REQUIRE_THROWS_AS(instance->getFlowReader(""), std::invalid_argument);
22 REQUIRE_THROWS_AS(instance->getFlowReader("not-a-uuid"), std::invalid_argument);
23 REQUIRE_THROWS_AS(instance->getFlowReader("5fbec3b1-1b0f-417d-9059-8b94a47197e"), std::invalid_argument);
24}
TEST_CASE_PERSISTENT_FIXTURE(mxl::tests::mxlDomainFixture, "Instance : getFlowReader rejects invalid flow ids", "[instance]")