XmlParseParameterTest.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-05
  6. * Changed: 2023-03-25
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core.hpp>
  11. #include <ls-std/ls-std-io.hpp>
  12. using ls::std::core::IllegalArgumentException;
  13. using ls::std::io::XmlNode;
  14. using ls::std::io::XmlParseParameter;
  15. using std::make_shared;
  16. using testing::Test;
  17. namespace
  18. {
  19. class XmlParseParameterTest : public Test
  20. {
  21. public:
  22. XmlParseParameterTest() = default;
  23. ~XmlParseParameterTest() override = default;
  24. };
  25. TEST_F(XmlParseParameterTest, getLevel)
  26. {
  27. XmlParseParameter parameter{};
  28. ASSERT_EQ(0, parameter.getLevel());
  29. }
  30. TEST_F(XmlParseParameterTest, getNode)
  31. {
  32. XmlParseParameter parameter{};
  33. ASSERT_TRUE(parameter.getNode() == nullptr);
  34. }
  35. TEST_F(XmlParseParameterTest, setLevel)
  36. {
  37. XmlParseParameter parameter{};
  38. parameter.setLevel(3);
  39. ASSERT_EQ(3, parameter.getLevel());
  40. }
  41. TEST_F(XmlParseParameterTest, setNode)
  42. {
  43. XmlParseParameter parameter{};
  44. parameter.setNode(make_shared<XmlNode>("node"));
  45. ASSERT_TRUE(parameter.getNode() != nullptr);
  46. }
  47. TEST_F(XmlParseParameterTest, setNode_no_reference)
  48. {
  49. XmlParseParameter parameter{};
  50. EXPECT_THROW(
  51. {
  52. try
  53. {
  54. parameter.setNode(nullptr);
  55. }
  56. catch (const IllegalArgumentException &_exception)
  57. {
  58. throw;
  59. }
  60. },
  61. IllegalArgumentException);
  62. }
  63. }