### Question:
JmsStreamMessage extends JmsMessage implements StreamMessage { @Override public char readChar() throws JMSException { initializeReading(); checkEndOfStream(); Object value = stream.get(index++); if (value instanceof Character) { return (Character) value; } index--; if (value == null) { throw new NullPointerException("Cannot convert NULL value to char."); } else { throw new MessageFormatException("stream value is not a boolean type"); } } JmsStreamMessage(JmsMessageFacade facade); @Override JmsMessage copy(); @Override void onSend(); @Override void clearBody(); @Override boolean readBoolean(); @Override byte readByte(); @Override short readShort(); @Override char readChar(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override String readString(); @Override int readBytes(byte[] value); @Override Object readObject(); @Override void writeBoolean(boolean value); @Override void writeByte(byte value); @Override void writeShort(short value); @Override void writeChar(char value); @Override void writeInt(int value); @Override void writeLong(long value); @Override void writeFloat(float value); @Override void writeDouble(double value); @Override void writeString(String value); @Override void writeBytes(byte[] value); @Override void writeBytes(byte[] value, int offset, int length); @Override void writeObject(Object value); @Override void reset(); @Override String toString();  }### Answer:
@Test public void testReadChar() { JmsStreamMessage msg = factory.createStreamMessage(); try { char test = 'z'; msg.writeChar(test); msg.reset(); assertTrue(msg.readChar() == test); msg.reset(); assertTrue(msg.readString().equals(new Character(test).toString())); msg.reset(); try { msg.readBoolean(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readByte(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readShort(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readInt(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readLong(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readFloat(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readDouble(); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } msg.reset(); try { msg.readBytes(new byte[1]); fail("Should have thrown exception"); } catch (MessageFormatException mfe) { } } catch (JMSException jmsEx) { jmsEx.printStackTrace(); assertTrue(false); } }