/*
* Author:          Patrick-Christopher Mattulat
* Co-Author:       Claude Sonnet 4.6 (LLM)
* Company:         Lynar Studios
* E-Mail:          webmaster@lynarstudios.com
* Created:         2023-02-05
* Changed:         2026-06-23
*
* */

#include <gtest/gtest.h>
#include <ls-std/ls-std-core.hpp>
#include <ls-std/ls-std-io.hpp>

using ls::standard::core::IllegalArgumentException;
using ls::standard::io::XmlNode;
using ls::standard::io::XmlParseParameter;
using std::make_shared;
using testing::Test;

namespace
{
  class XmlParseParameterTest : public Test
  {
    public:

      XmlParseParameterTest() = default;
      ~XmlParseParameterTest() override = default;
  };

  TEST_F(XmlParseParameterTest, getLevel)
  {
    const XmlParseParameter parameter{};
    ASSERT_EQ(0, parameter.getLevel());
  }

  TEST_F(XmlParseParameterTest, getNode)
  {
    const XmlParseParameter parameter{};
    ASSERT_TRUE(parameter.getNode() == nullptr);
  }

  TEST_F(XmlParseParameterTest, setLevel)
  {
    XmlParseParameter parameter{};
    parameter.setLevel(3);

    ASSERT_EQ(3, parameter.getLevel());
  }

  TEST_F(XmlParseParameterTest, setNode)
  {
    XmlParseParameter parameter{};
    parameter.setNode(make_shared<XmlNode>("node"));

    ASSERT_TRUE(parameter.getNode() != nullptr);
  }

  TEST_F(XmlParseParameterTest, setNode_no_reference)
  {
    XmlParseParameter parameter{};

    EXPECT_THROW(
        {
          try
          {
            parameter.setNode(nullptr);
          }
          catch (const IllegalArgumentException &_exception)
          {
            throw;
          }
        },
        IllegalArgumentException);
  }
}
