()
| 1059 | |
| 1060 | #[test] |
| 1061 | fn invoke_method_with_primitive_args() -> errors::Result<()> { |
| 1062 | let jvm = create_tests_jvm()?; |
| 1063 | |
| 1064 | // Test the primitives in constructors. |
| 1065 | // The constructor of Integer takes a primitive int as an argument. |
| 1066 | let ia = InvocationArg::try_from(1_i32) |
| 1067 | ? |
| 1068 | .into_primitive() |
| 1069 | ?; |
| 1070 | let res1 = jvm.create_instance("java.lang.Integer", &[ia]); |
| 1071 | assert!(res1.is_ok()); |
| 1072 | |
| 1073 | // Test the primitives in invocations. |
| 1074 | let ia1 = InvocationArg::try_from(1_i32)?; |
| 1075 | let ia2 = InvocationArg::try_from(1_i32)?; |
| 1076 | let test_instance = jvm |
| 1077 | .create_instance("org.astonbitecode.j4rs.tests.MyTest", InvocationArg::empty()) |
| 1078 | ?; |
| 1079 | let res2 = jvm.invoke( |
| 1080 | &test_instance, |
| 1081 | "addInts", |
| 1082 | &[ia1.into_primitive()?, ia2.into_primitive()?], |
| 1083 | ); |
| 1084 | assert!(res2.is_ok()); |
| 1085 | |
| 1086 | Ok(()) |
| 1087 | } |
| 1088 | |
| 1089 | #[test] |
| 1090 | fn to_tust_returns_list() -> errors::Result<()> { |
nothing calls this directly
no test coverage detected