SectionPairIdentifierArgumentEvaluatorTest.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-09
  6. * Changed: 2023-02-17
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core.hpp>
  11. #include <ls-std/ls-std-io.hpp>
  12. #include <string>
  13. using namespace ls::std::core;
  14. using namespace ls::std::io;
  15. using namespace ::std;
  16. namespace
  17. {
  18. class SectionPairIdentifierArgumentEvaluatorTest : public ::testing::Test
  19. {
  20. protected:
  21. SectionPairIdentifierArgumentEvaluatorTest() = default;
  22. ~SectionPairIdentifierArgumentEvaluatorTest() override = default;
  23. void SetUp() override
  24. {}
  25. void TearDown() override
  26. {}
  27. };
  28. TEST_F(SectionPairIdentifierArgumentEvaluatorTest, getClassName)
  29. {
  30. shared_ptr<SectionPairIdentifierArgumentEvaluator> evaluator = make_shared<SectionPairIdentifierArgumentEvaluator>("_id", "not valid!");
  31. ASSERT_STREQ("SectionPairIdentifierArgumentEvaluator", evaluator->getClassName().c_str());
  32. }
  33. TEST_F(SectionPairIdentifierArgumentEvaluatorTest, evaluate)
  34. {
  35. EXPECT_THROW(
  36. {
  37. try
  38. {
  39. SectionPairIdentifierArgumentEvaluator("_color", "section pair identifier contains invalid characters!").evaluate();
  40. }
  41. catch (const IllegalArgumentException &_exception)
  42. {
  43. ::std::string message = _exception.what();
  44. ASSERT_STREQ("IllegalArgumentException thrown - section pair identifier contains invalid characters!", message.c_str());
  45. throw;
  46. }
  47. },
  48. IllegalArgumentException);
  49. }
  50. }