JniApiTest.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-04-07
  6. * Changed: 2023-04-10
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core-jni.hpp>
  11. #include <ls-std/ls-std-core.hpp>
  12. #include <string>
  13. using ls::std::core::IllegalArgumentException;
  14. using ls::std::core::experimental::JniApi;
  15. using std::string;
  16. using testing::Test;
  17. namespace
  18. {
  19. class JniApiTest : public Test
  20. {
  21. public:
  22. JniApiTest() = default;
  23. ~JniApiTest() override = default;
  24. };
  25. TEST_F(JniApiTest, constructor)
  26. {
  27. EXPECT_THROW(
  28. {
  29. try
  30. {
  31. JniApi jniApi{nullptr};
  32. }
  33. catch (const IllegalArgumentException &_exception)
  34. {
  35. string expected = _exception.getName() + " thrown - Java environment is not being provided!";
  36. string actual = _exception.what();
  37. ASSERT_STREQ(expected.c_str(), actual.c_str());
  38. throw;
  39. }
  40. },
  41. IllegalArgumentException);
  42. }
  43. }