### Question:
SPPDecoder implements MALDecoder { @Override public Boolean decodeBoolean() throws MALException { byte b = read(); switch (b) { case 0: return Boolean.FALSE; case 1: return Boolean.TRUE; default: throw new MALException(INVALID_VALUE); } } SPPDecoder(final InputStream inputStream, final Map properties); @Override Boolean decodeBoolean(); @Override Boolean decodeNullableBoolean(); @Override Float decodeFloat(); @Override Float decodeNullableFloat(); @Override Double decodeDouble(); @Override Double decodeNullableDouble(); @Override Byte decodeOctet(); @Override Byte decodeNullableOctet(); @Override UOctet decodeUOctet(); @Override UOctet decodeNullableUOctet(); @Override Short decodeShort(); @Override Short decodeNullableShort(); @Override UShort decodeUShort(); @Override UShort decodeNullableUShort(); @Override Integer decodeInteger(); @Override Integer decodeNullableInteger(); @Override UInteger decodeUInteger(); @Override UInteger decodeNullableUInteger(); @Override Long decodeLong(); @Override Long decodeNullableLong(); @Override ULong decodeULong(); @Override ULong decodeNullableULong(); @Override String decodeString(); @Override String decodeNullableString(); @Override Blob decodeBlob(); @Override Blob decodeNullableBlob(); @Override Duration decodeDuration(); @Override Duration decodeNullableDuration(); @Override FineTime decodeFineTime(); @Override FineTime decodeNullableFineTime(); @Override Identifier decodeIdentifier(); @Override Identifier decodeNullableIdentifier(); @Override Time decodeTime(); @Override Time decodeNullableTime(); @Override URI decodeURI(); @Override URI decodeNullableURI(); @Override Element decodeElement(final Element element); @Override Element decodeNullableElement(final Element element); @Override Attribute decodeAttribute(); @Override Attribute decodeNullableAttribute(); @Override MALListDecoder createListDecoder(final List list);  }### Answer:
@Test public void testDecodeBoolean2() throws Exception { newBuffer(new byte[]{1}); assertEquals(Boolean.TRUE, decoder.decodeBoolean()); }
@Test public void testDecodeBoolean3() throws Exception { newBuffer(new byte[]{0, 1, 0}); assertEquals(Boolean.FALSE, decoder.decodeBoolean()); assertEquals(Boolean.TRUE, decoder.decodeBoolean()); assertEquals(Boolean.FALSE, decoder.decodeBoolean()); }
@Test public void testDecodeBoolean1() throws Exception { newBuffer(new byte[]{0}); assertEquals(Boolean.FALSE, decoder.decodeBoolean()); }
@Test public void testDecodeBooleanExpectedException1() throws Exception { newBuffer(new byte[]{2}); try { decoder.decodeBoolean(); fail("Expected exception, but none thrown."); } catch (MALException ex) { assertEquals(SPPDecoder.INVALID_VALUE, ex.getMessage()); } }
@Test public void testDecodeBooleanExpectedException3() throws Exception { newBuffer(new byte[]{}); try { decoder.decodeBoolean(); fail("Expected exception, but none thrown."); } catch (MALException ex) { assertEquals(SPPDecoder.INSUFFICIENT_DATA, ex.getMessage()); } }