### Question:
CompactEncoder { public static byte[] packNibbles(byte[] nibbles) { int terminator = 0; int len = nibbles.length; if (len > 0 && nibbles[len - 1] == TERMINATOR) { terminator = 1; --len; } int oddlen = len & 1; int flag = (terminator << 1) + oddlen; byte[] output = new byte[(len >>> 1) + 1]; if (oddlen != 0) { output[0] = (byte) ((flag << 4) + nibbles[0]); } else { output[0] = (byte) (flag << 4); } for (int i = oddlen, index = 1; i < len; i += 2, index++) { output[index] = (byte) ((nibbles[i] << 4) + nibbles[i + 1]); } return output; }  static byte[] packNibbles(byte[] nibbles); static boolean hasTerminator(byte[] packedKey); static byte[] unpackToNibbles(byte[] str); static byte[] binToNibbles(byte[] str);  }### Answer:
@Test(expected = NullPointerException.class) public void testCompactEncode_wNullArray() { CompactEncoder.packNibbles(null); }