### Question:
SPPEncoder implements MALEncoder, MALListEncoder { @Override public void encodeAttribute(final Attribute att) throws IllegalArgumentException, MALException { if (att == null) { throw new IllegalArgumentException(ILLEGAL_NULL_ARGUMENT); } encodeUOctet(new UOctet((short) (att.getTypeShortForm().byteValue() - 1))); att.encode(this); } 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 testEncodeAttribute1() throws Exception { encoder.encodeAttribute(new UInteger(42)); assertArrayEquals(new byte[]{11, 42}, outputStream.toByteArray()); }
@Test public void testEncodeAttribute2() throws Exception { encoder.encodeAttribute(new Union(new Integer(42))); assertArrayEquals(new byte[]{10, 84}, outputStream.toByteArray()); }
@Test(expected = IllegalArgumentException.class) public void testEncodeAttributeExpectedException() throws Exception { encoder.encodeAttribute(null); }