()
| 223 | |
| 224 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 225 | async fn invoke_async_and_reuse_instance() -> errors::Result<()> { |
| 226 | let s_test1 = "j4rs_rust1"; |
| 227 | let s_test2 = "j4rs_rust2"; |
| 228 | let jvm = create_tests_jvm()?; |
| 229 | let my_test = jvm.create_instance("org.astonbitecode.j4rs.tests.MyTest", InvocationArg::empty())?; |
| 230 | let instance1 = jvm |
| 231 | .invoke_async( |
| 232 | &my_test, |
| 233 | "getStringWithFuture", |
| 234 | &[InvocationArg::try_from(s_test1)?], |
| 235 | ) |
| 236 | .await?; |
| 237 | let instance2 = jvm |
| 238 | .invoke_async( |
| 239 | &my_test, |
| 240 | "getStringWithFuture", |
| 241 | &[InvocationArg::try_from(s_test2)?], |
| 242 | ) |
| 243 | .await?; |
| 244 | let string1: String = jvm.to_rust(instance1)?; |
| 245 | let string2: String = jvm.to_rust(instance2)?; |
| 246 | assert_eq!(s_test1, string1); |
| 247 | assert_eq!(s_test2, string2); |
| 248 | Ok(()) |
| 249 | } |
| 250 | |
| 251 | #[tokio::test(flavor = "multi_thread", worker_threads = 1)] |
| 252 | async fn invoke_static_async() -> errors::Result<()> { |
nothing calls this directly
no test coverage detected