MCPcopy Index your code
hub / github.com/astonbitecode/j4rs / clone_instance

Function clone_instance

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

Source from the content-addressed store, hash-verified

369
370 #[test]
371 fn clone_instance() -> errors::Result<()> {
372 let jvm = create_tests_jvm()?;
373 // Create a MyTest instance
374 let i_result =
375 jvm.create_instance("org.astonbitecode.j4rs.tests.MyTest", InvocationArg::empty());
376 assert!(i_result.is_ok());
377 let i_arg = i_result?;
378
379 // Create two clones of the instance
380 let i1 = jvm.clone_instance(&i_arg)?;
381 let i2 = jvm.clone_instance(&i_arg)?;
382 // Use the clones as arguments
383 let invocation_res = jvm.create_instance(
384 "org.astonbitecode.j4rs.tests.MyTest",
385 &[InvocationArg::from(i1)],
386 );
387 assert!(invocation_res.is_ok());
388 let invocation_res = jvm.create_instance(
389 "org.astonbitecode.j4rs.tests.MyTest",
390 &[InvocationArg::from(i2)],
391 );
392 assert!(invocation_res.is_ok());
393
394 Ok(())
395 }
396
397 // #[test]
398 // #[ignore]

Callers

nothing calls this directly

Calls 3

create_tests_jvmFunction · 0.85
create_instanceMethod · 0.80
clone_instanceMethod · 0.45

Tested by

no test coverage detected