### Question:
SPPEncoder implements MALEncoder, MALListEncoder { @Override public void encodeNullableShort(final Short att) throws MALException { encodeNulltag(att); if (att != null) { encodeShort(att); } } 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 testEncodeNullableShort1() throws Exception { encoder.encodeNullableShort(null); assertArrayEquals(new byte[]{0}, outputStream.toByteArray()); }
@Test public void testEncodeNullableShort2() throws Exception { encoder.encodeNullableShort((short) -31415); encoder.encodeNullableShort((short) 8193); encoder.encodeNullableShort((short) 0); encoder.encodeNullableShort((short) -256); encoder.encodeNullableShort(null); assertArrayEquals(new byte[]{ 1, (byte) 0b11101101, (byte) 0b11101010, (byte) 0b00000011, 1, (byte) 0b10000010, (byte) 0b10000000, (byte) 0b00000001, 1, (byte) 0, 1, (byte) 0b11111111, (byte) 0b00000011, 0 }, outputStream.toByteArray()); }
@Test public void testEncodeNullableShort2b() throws Exception { setVarintSupportedProperty(false); encoder.encodeNullableShort((short) -31415); encoder.encodeNullableShort((short) 8193); encoder.encodeNullableShort((short) 0); encoder.encodeNullableShort((short) -256); encoder.encodeNullableShort(null); assertArrayEquals(new byte[]{ 1, (byte) 0x85, (byte) 0x49, 1, (byte) 0x20, (byte) 0x01, 1, 0, 0, 1, (byte) 0xFF, 0, 0 }, outputStream.toByteArray()); }