ClassTest.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-16
  6. * Changed: 2023-05-15
  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. public:
  23. ClassTest() = default;
  24. ~ClassTest() override = default;
  25. };
  26. TEST_F(ClassTest, constructor_empty_parameter)
  27. {
  28. EXPECT_THROW(
  29. {
  30. try
  31. {
  32. Class object{""};
  33. }
  34. catch (const IllegalArgumentException &_exception)
  35. {
  36. throw;
  37. }
  38. },
  39. IllegalArgumentException);
  40. }
  41. TEST_F(ClassTest, destructor)
  42. {
  43. auto object = make_shared<ClassWrapper>();
  44. EXPECT_CALL(*object, Die());
  45. }
  46. TEST_F(ClassTest, getClassName)
  47. {
  48. Class object{"Class"};
  49. ASSERT_STREQ("Class", object.getClassName().c_str());
  50. }
  51. }