} catch (MessageNotWriteableException mnwe) {
}
}
public void testReadOnlyBody() throws JMSException {
ActiveMQBytesMessage message = new ActiveMQBytesMessage();
try {
message.writeBoolean(true);
message.writeByte((byte) 1);
message.writeByte((byte) 1);
message.writeBytes(new byte[1]);
message.writeBytes(new byte[3], 0, 2);
message.writeChar('a');
message.writeDouble(1.5);
message.writeFloat((float) 1.5);
message.writeInt(1);
message.writeLong(1);
message.writeObject("stringobj");
message.writeShort((short) 1);
message.writeShort((short) 1);
message.writeUTF("utfstring");
} catch (MessageNotWriteableException mnwe) {
fail("Should be writeable");
}
message.reset();
try {
message.readBoolean();
message.readByte();
message.readUnsignedByte();
message.readBytes(new byte[1]);
message.readBytes(new byte[2], 2);
message.readChar();
message.readDouble();
message.readFloat();
message.readInt();
message.readLong();
message.readUTF();
message.readShort();
message.readUnsignedShort();
message.readUTF();
} catch (MessageNotReadableException mnwe) {
fail("Should be readable");
}
try {
message.writeBoolean(true);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeByte((byte) 1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeBytes(new byte[1]);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeBytes(new byte[3], 0, 2);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeChar('a');
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeDouble(1.5);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeFloat((float) 1.5);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeInt(1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeLong(1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeObject("stringobj");
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeShort((short) 1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
try {
message.writeUTF("utfstring");
fail("Should have thrown exception");
} catch (MessageNotWriteableException mnwe) {
}
}