MCPcopy Index your code
hub / github.com/java-native-access/jna / testToByteArray

Method testToByteArray

test/com/sun/jna/NativeTest.java:377–383  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

375 }
376
377 public void testToByteArray() {
378 final String VALUE = getName();
379 byte[] buf = Native.toByteArray(VALUE);
380 assertEquals("Wrong byte array length", VALUE.getBytes().length+1, buf.length);
381 assertEquals("Missing NUL terminator", (byte)0, buf[buf.length-1]);
382 assertEquals("Wrong byte array contents", VALUE, new String(buf, 0, buf.length-1));
383 }
384
385 public void testToByteArrayWithEncoding() throws Exception {
386 final String ENCODING = "utf8";

Callers

nothing calls this directly

Calls 3

toByteArrayMethod · 0.95
getNameMethod · 0.65
getBytesMethod · 0.45

Tested by

no test coverage detected