### Question:
SPPEncoder implements MALEncoder, MALListEncoder { @Override public void encodeUOctet(final UOctet att) throws IllegalArgumentException, MALException { if (att == null) { throw new IllegalArgumentException(ILLEGAL_NULL_ARGUMENT); } write(att.getValue()); } SPPEncoder(final OutputStream outputStream, final Map properties); @Override void encodeBoolean(final Boolean att); @Override void encodeNullableBoolean(final Boolean att); @Override void encodeFloat(final Float att); @Override void encodeNullableFloat(final Float att); @Override void encodeDouble(final Double att); @Override void encodeNullableDouble(final Double att); @Override void encodeOctet(final Byte att); @Override void encodeNullableOctet(final Byte att); @Override void encodeUOctet(final UOctet att); @Override void encodeNullableUOctet(final UOctet att); @Override void encodeShort(final Short att); @Override void encodeNullableShort(final Short att); @Override void encodeUShort(final UShort att); @Override void encodeNullableUShort(final UShort att); @Override void encodeInteger(final Integer att); @Override void encodeNullableInteger(final Integer att); @Override void encodeUInteger(final UInteger att); @Override void encodeNullableUInteger(final UInteger att); @Override void encodeLong(final Long att); @Override void encodeNullableLong(final Long att); @Override void encodeULong(final ULong att); @Override void encodeNullableULong(final ULong att); @Override void encodeString(final String att); @Override void encodeNullableString(final String att); @Override void encodeBlob(final Blob att); @Override void encodeNullableBlob(final Blob att); @Override void encodeDuration(final Duration att); @Override void encodeNullableDuration(final Duration att); @Override void encodeFineTime(final FineTime att); @Override void encodeNullableFineTime(final FineTime att); @Override void encodeIdentifier(final Identifier att); @Override void encodeNullableIdentifier(final Identifier att); @Override void encodeTime(final Time att); @Override void encodeNullableTime(final Time att); @Override void encodeURI(final URI att); @Override void encodeNullableURI(final URI att); @Override void encodeElement(final Element element); @Override void encodeNullableElement(final Element element); @Override void encodeAttribute(final Attribute att); @Override void encodeNullableAttribute(final Attribute att); @Override MALListEncoder createListEncoder(final List list); @Override void close();  }### Answer:
@Test public void testEncodeUOctet1() throws Exception { encoder.encodeUOctet(new UOctet((short) 0)); assertArrayEquals(new byte[]{(byte) 0b00000000}, outputStream.toByteArray()); }
@Test public void testEncodeUOctet2() throws Exception { encoder.encodeUOctet(new UOctet((short) 255)); assertArrayEquals(new byte[]{(byte) 0b11111111}, outputStream.toByteArray()); }
@Test public void testEncodeUOctet3() throws Exception { encoder.encodeUOctet(new UOctet((short) 1)); assertArrayEquals(new byte[]{(byte) 0b00000001}, outputStream.toByteArray()); }
@Test public void testEncodeUOctet4() throws Exception { encoder.encodeUOctet(new UOctet((short) 42)); assertArrayEquals(new byte[]{(byte) 0b00101010}, outputStream.toByteArray()); }
@Test public void testEncodeUOctet5() throws Exception { encoder.encodeUOctet(new UOctet((short) 207)); assertArrayEquals(new byte[]{(byte) 0b11001111}, outputStream.toByteArray()); }
@Test public void testEncodeUOctet6() throws Exception { encoder.encodeUOctet(new UOctet((short) 128)); encoder.encodeUOctet(new UOctet((short) 14)); assertArrayEquals(new byte[]{(byte) 0b10000000, (byte) 0b00001110}, outputStream.toByteArray()); }
@Test(expected = IllegalArgumentException.class) public void testEncodeUOctetExpectedException() throws Exception { encoder.encodeUOctet(null); }