MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / variadic_string_method

Function variadic_string_method

rust/src/lib.rs:812–838  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

810
811 #[test]
812 fn variadic_string_method() -> errors::Result<()> {
813 let jvm = create_tests_jvm()?;
814 let test_instance = jvm
815 .create_instance("org.astonbitecode.j4rs.tests.MyTest", InvocationArg::empty())
816 ?;
817
818 let s1 = InvocationArg::try_from("abc")?;
819 let s2 = InvocationArg::try_from("def")?;
820 let s3 = InvocationArg::try_from("ghi")?;
821
822 let arr_instance = jvm
823 .create_java_array("java.lang.String", &vec![s1, s2, s3])
824 ?;
825
826 let i = jvm
827 .invoke(
828 &test_instance,
829 "getMyWithArgsList",
830 &[InvocationArg::from(arr_instance)],
831 )
832 ?;
833
834 let s: String = jvm.to_rust(i)?;
835 assert!(s == "abcdefghi");
836
837 Ok(())
838 }
839
840 #[test]
841 fn variadic_int_method() -> errors::Result<()> {

Callers

nothing calls this directly

Calls 5

create_tests_jvmFunction · 0.85
create_instanceMethod · 0.80
create_java_arrayMethod · 0.80
invokeMethod · 0.65
to_rustMethod · 0.45

Tested by

no test coverage detected