()
| 524 | |
| 525 | #[test] |
| 526 | fn test_throw_unwind_panic() { |
| 527 | test_utils::JVM_ENV.with(|env| { |
| 528 | super::throw_unwind(env, || panic!("This is a panic")) |
| 529 | .unwrap_err() |
| 530 | .unwrap(); |
| 531 | assert!(env.exception_check().unwrap()); |
| 532 | let ex = env.exception_occurred().unwrap(); |
| 533 | env.exception_clear().unwrap(); |
| 534 | assert!( |
| 535 | env.is_instance_of(ex, "io/github/gedgygedgy/rust/panic/PanicException") |
| 536 | .unwrap() |
| 537 | ); |
| 538 | |
| 539 | let suppressed_list = env |
| 540 | .call_method(ex, "getSuppressed", "()[Ljava/lang/Throwable;", &[]) |
| 541 | .unwrap() |
| 542 | .l() |
| 543 | .unwrap(); |
| 544 | assert_eq!( |
| 545 | env.get_array_length(suppressed_list.into_inner()).unwrap(), |
| 546 | 0 |
| 547 | ); |
| 548 | |
| 549 | let ex = super::JPanicException::from_env(env, ex).unwrap(); |
| 550 | let any = ex.take().unwrap(); |
| 551 | let str = any.downcast::<&str>().unwrap(); |
| 552 | assert_eq!(*str, "This is a panic"); |
| 553 | }); |
| 554 | } |
| 555 | |
| 556 | #[test] |
| 557 | fn test_throw_unwind_panic_suppress() { |
nothing calls this directly
no test coverage detected