AbstractIetfYangUtil { public final byte @NonNull[] physAddressBytes(final @NonNull P physAddress) { final String str = getPhysValue(physAddress); return str.isEmpty() ? EMPTY_BYTES : stringToBytes(str, str.length() / 3 + 1); } protected  AbstractIetfYangUtil(final Class<M> macClass, final Class<P> physClass, final Class<H> hexClass,
            final Class<Q> quadClass, final Class<U> uuidClass); final @NonNull M canonizeMacAddress(final @NonNull M macAddress); final @NonNull M macAddressFor(final byte @NonNull[] bytes); final byte @NonNull[] macAddressBytes(final @NonNull M macAddress); final @NonNull P canonizePhysAddress(final @NonNull P physAddress); final @NonNull P physAddressFor(final byte @NonNull[] bytes); final byte @NonNull[] physAddressBytes(final @NonNull P physAddress); final @NonNull H hexStringFor(final byte @NonNull[] bytes); final byte @NonNull[] hexStringBytes(final @NonNull H hexString); final @NonNull Q dottedQuadFor(final byte @NonNull[] bytes); final @NonNull Q dottedQuadFor(final int bits); final int dottedQuadBits(final @NonNull Q dottedQuad); final byte @NonNull[] dottedQuadBytes(final @NonNull Q dottedQuad); final @NonNull U uuidFor(final @NonNull UUID uuid);  }
@Test public void testPhysToBytes() { final byte[] bytes1 = UTIL.physAddressBytes(new PhysClass(CANON)); assertArrayEquals(BYTES, bytes1); final byte[] bytes2 = UTIL.physAddressBytes(new PhysClass("01:02:1E:5a:Fb:88")); assertArrayEquals(BYTES, bytes2); assertArrayEquals(new byte[0], UTIL.physAddressBytes(new PhysClass(""))); assertArrayEquals(new byte[] { (byte) 0xaa }, UTIL.physAddressBytes(new PhysClass("aa"))); assertArrayEquals(new byte[] { (byte) 0xaa, (byte) 0xbb }, UTIL.physAddressBytes(new PhysClass("aa:bb"))); }