XmlParseParameterTest.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-05
  6. * Changed: 2023-02-23
  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. protected:
  22. XmlParseParameterTest() = default;
  23. ~XmlParseParameterTest() override = default;
  24. void SetUp() override
  25. {}
  26. void TearDown() override
  27. {}
  28. };
  29. TEST_F(XmlParseParameterTest, getLevel)
  30. {
  31. XmlParseParameter parameter{};
  32. ASSERT_EQ(0, parameter.getLevel());
  33. }
  34. TEST_F(XmlParseParameterTest, getNode)
  35. {
  36. XmlParseParameter parameter{};
  37. ASSERT_TRUE(parameter.getNode() == nullptr);
  38. }
  39. TEST_F(XmlParseParameterTest, setLevel)
  40. {
  41. XmlParseParameter parameter{};
  42. parameter.setLevel(3);
  43. ASSERT_EQ(3, parameter.getLevel());
  44. }
  45. TEST_F(XmlParseParameterTest, setNode)
  46. {
  47. XmlParseParameter parameter{};
  48. parameter.setNode(make_shared<XmlNode>("node"));
  49. ASSERT_TRUE(parameter.getNode() != nullptr);
  50. }
  51. TEST_F(XmlParseParameterTest, setNode_no_reference)
  52. {
  53. XmlParseParameter parameter{};
  54. EXPECT_THROW(
  55. {
  56. try
  57. {
  58. parameter.setNode(nullptr);
  59. }
  60. catch (const IllegalArgumentException &_exception)
  61. {
  62. throw;
  63. }
  64. },
  65. IllegalArgumentException);
  66. }
  67. }