MCPcopy Create free account
hub / github.com/CodeIntelligenceTesting/jazzer / TEST_F

Function TEST_F

launcher/jvm_tooling_test.cpp:53–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51std::unique_ptr<JVM> JvmToolingTest::jvm_ = nullptr;
52
53TEST_F(JvmToolingTest, JniProperties) {
54 auto &env = jvm_->GetEnv();
55 auto property_printer_class = env.FindClass("test/PropertyPrinter");
56 ASSERT_NE(nullptr, property_printer_class);
57 auto method_id =
58 env.GetStaticMethodID(property_printer_class, "printProperty",
59 "(Ljava/lang/String;)Ljava/lang/String;");
60 ASSERT_NE(nullptr, method_id);
61
62 for (const auto &el : std::vector<std::pair<std::string, std::string>>{
63 {"not set property", ""},
64 {"env1", "va" ARG_SEPARATOR "l1\\"},
65 {"env2", "val2"}}) {
66 jstring str = env.NewStringUTF(el.first.c_str());
67 auto ret = (jstring)env.CallStaticObjectMethod(property_printer_class,
68 method_id, str);
69 ASSERT_FALSE(env.ExceptionCheck());
70 if (el.second.empty()) {
71 ASSERT_EQ(nullptr, ret);
72 } else {
73 ASSERT_NE(nullptr, ret);
74 jboolean is_copy;
75 ASSERT_EQ(el.second, env.GetStringUTFChars(ret, &is_copy));
76 }
77 }
78}
79} // namespace jazzer

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected