ClassTest.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-16
  6. * Changed: 2023-02-22
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std-core-test.hpp>
  11. #include <ls-std/ls-std-core.hpp>
  12. using ls::std::core::Class;
  13. using ls::std::core::IllegalArgumentException;
  14. using std::make_shared;
  15. using std::shared_ptr;
  16. using test::core::ClassWrapper;
  17. using testing::Test;
  18. namespace
  19. {
  20. class ClassTest : public Test
  21. {
  22. protected:
  23. ClassTest() = default;
  24. ~ClassTest() override = default;
  25. void SetUp() override
  26. {}
  27. void TearDown() override
  28. {}
  29. };
  30. TEST_F(ClassTest, constructor_empty_parameter)
  31. {
  32. EXPECT_THROW(
  33. {
  34. try
  35. {
  36. Class object{""};
  37. }
  38. catch (const IllegalArgumentException &_exception)
  39. {
  40. throw;
  41. }
  42. },
  43. IllegalArgumentException);
  44. }
  45. TEST_F(ClassTest, destructor)
  46. {
  47. shared_ptr<ClassWrapper> object = make_shared<ClassWrapper>();
  48. EXPECT_CALL(*object, Die());
  49. }
  50. TEST_F(ClassTest, getClassName)
  51. {
  52. Class object{"Class"};
  53. ASSERT_STREQ("Class", object.getClassName().c_str());
  54. }
  55. }