### Question:
PathEncoder { @Nonnull static byte[] decode(byte[] encoded, int length) { if (encoded == null) { throw new IllegalArgumentException("encoded"); } return decodeBinaryPath(encoded, length); } private  PathEncoder();   }### Answer:
@Test public void decodeNullBinaryPath() { try { PathEncoder.decode(null, 0); Assert.fail(); } catch (Exception ex) { Assert.assertTrue(ex instanceof IllegalArgumentException); } }
@Test public void decodeBinaryPathOneByte() { byte[] encoded = new byte[] { 0x6d }; byte[] path = PathEncoder.decode(encoded, 8); Assert.assertNotNull(path); Assert.assertArrayEquals(new byte[] { 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01 }, path); }
@Test public void decodeBinaryPathNineBits() { byte[] encoded = new byte[] { 0x6d, (byte)0x80 }; byte[] path = PathEncoder.decode(encoded, 9); Assert.assertNotNull(path); Assert.assertArrayEquals(new byte[] { 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01 }, path); }
@Test public void decodeBinaryPathOneAndHalfByte() { byte[] encoded = new byte[] { 0x6d, 0x50 }; byte[] path = PathEncoder.decode(encoded, 12); Assert.assertNotNull(path); Assert.assertArrayEquals(new byte[] { 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 }, path); }