JniApiTest.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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-04-07
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #include <gtest/gtest.h>
  11. #include <ls-std/ls-std-core-jni.hpp>
  12. #include <ls-std/ls-std-core.hpp>
  13. #include <string>
  14. using ls::standard::core::IllegalArgumentException;
  15. using ls::standard::core::experimental::JniApi;
  16. using std::string;
  17. using testing::Test;
  18. namespace
  19. {
  20. class JniApiTest : public Test
  21. {
  22. public:
  23. JniApiTest() = default;
  24. ~JniApiTest() override = default;
  25. };
  26. TEST_F(JniApiTest, constructor)
  27. {
  28. EXPECT_THROW(
  29. {
  30. try
  31. {
  32. JniApi jniApi{nullptr};
  33. }
  34. catch (const IllegalArgumentException &_exception)
  35. {
  36. string expected = _exception.getName() + " thrown - Java environment is not being provided!";
  37. string actual = _exception.what();
  38. ASSERT_STREQ(expected.c_str(), actual.c_str());
  39. throw;
  40. }
  41. },
  42. IllegalArgumentException);
  43. }
  44. }