EmptyStringArgumentEvaluatorTest.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2023-02-08
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #include <gtest/gtest.h>
  11. #include <ls-std/ls-std-core.hpp>
  12. #include <string>
  13. using ls::standard::core::EmptyStringArgumentEvaluator;
  14. using ls::standard::core::IllegalArgumentException;
  15. using std::string;
  16. using testing::Test;
  17. namespace
  18. {
  19. class EmptyStringArgumentEvaluatorTest : public Test
  20. {
  21. public:
  22. EmptyStringArgumentEvaluatorTest() = default;
  23. ~EmptyStringArgumentEvaluatorTest() override = default;
  24. };
  25. TEST_F(EmptyStringArgumentEvaluatorTest, evaluate)
  26. {
  27. EXPECT_THROW(
  28. {
  29. try
  30. {
  31. EmptyStringArgumentEvaluator{""}.evaluate();
  32. }
  33. catch (const IllegalArgumentException &_exception)
  34. {
  35. const string actual = _exception.what();
  36. const string expected = _exception.getName() + " thrown - passed argument is empty!";
  37. ASSERT_STREQ(expected.c_str(), actual.c_str());
  38. throw;
  39. }
  40. },
  41. IllegalArgumentException);
  42. }
  43. TEST_F(EmptyStringArgumentEvaluatorTest, evaluate_dedicated_message)
  44. {
  45. EXPECT_THROW(
  46. {
  47. try
  48. {
  49. EmptyStringArgumentEvaluator("", "this id is empty!").evaluate();
  50. }
  51. catch (const IllegalArgumentException &_exception)
  52. {
  53. const string actual = _exception.what();
  54. const string expected = _exception.getName() + " thrown - this id is empty!";
  55. ASSERT_STREQ(expected.c_str(), actual.c_str());
  56. throw;
  57. }
  58. },
  59. IllegalArgumentException);
  60. }
  61. }