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

Function variadic_constructor

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

Source from the content-addressed store, hash-verified

783
784 #[test]
785 fn variadic_constructor() -> errors::Result<()> {
786 let jvm = create_tests_jvm()?;
787
788 let s1 = InvocationArg::try_from("abc")?;
789 let s2 = InvocationArg::try_from("def")?;
790 let s3 = InvocationArg::try_from("ghi")?;
791
792 let arr_instance = jvm
793 .create_java_array("java.lang.String", &vec![s1, s2, s3])
794 ?;
795
796 let test_instance = jvm
797 .create_instance(
798 "org.astonbitecode.j4rs.tests.MyTest",
799 &[InvocationArg::from(arr_instance)],
800 )
801 ?;
802
803 let i = jvm.invoke(&test_instance, "getMyString", InvocationArg::empty())?;
804
805 let s: String = jvm.to_rust(i)?;
806 assert!(s == "abc, def, ghi");
807
808 Ok(())
809 }
810
811 #[test]
812 fn variadic_string_method() -> errors::Result<()> {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected