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

Function test_byte_array_to_rust

rust/src/api/mod.rs:2263–2280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2261
2262 #[test]
2263 fn test_byte_array_to_rust() -> errors::Result<()> {
2264 let jvm = create_tests_jvm()?;
2265 let rust_value: Vec<i8> = vec![-3_i8, 7_i8, 8_i8];
2266 let ia: Vec<_> = rust_value
2267 .iter()
2268 .map(|x| {
2269 InvocationArg::try_from(x)
2270 .unwrap()
2271 .into_primitive()
2272 .unwrap()
2273 })
2274 .collect();
2275 let java_instance = jvm.create_java_array(PRIMITIVE_BYTE, &ia)?;
2276 let rust_value_from_java: Vec<i8> = jvm.to_rust(java_instance)?;
2277 assert_eq!(rust_value_from_java, rust_value);
2278
2279 Ok(())
2280 }
2281
2282 #[test]
2283 fn test_short_array_to_rust() -> errors::Result<()> {

Callers

nothing calls this directly

Calls 6

create_tests_jvmFunction · 0.85
collectMethod · 0.80
mapMethod · 0.80
into_primitiveMethod · 0.80
create_java_arrayMethod · 0.80
to_rustMethod · 0.45

Tested by

no test coverage detected