219220221222223224225226227228229
{ JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeBytes(new byte[]{2, 3, 4, 5, 6, 7, 8}); bm.writeBytes(new byte[]{2, 3, 4, 5, 6, 7}); bm.writeString("Foo"); bm.reset(); int len; do { len = bm.readBytes(new byte[2]); }
242243244245246247248249250251252
{ JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); byte[] bytes = {2, 3, 4}; bm.writeBytes(bytes); bm.writeBytes(bytes); bm.reset(); byte[] result = new byte[2]; int len = bm.readBytes(result); assertEquals(2, len); len = bm.readBytes(result); assertEquals(1, len);
258259260261262263264265266267268
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeByte((byte)1); bm.reset(); bm.readByte(); // should throw bm.readByte(); fail("expected exception did not occur"); }
280281282283284285286287288289290
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeBoolean(true); bm.reset(); bm.readBoolean(); // should throw bm.readBoolean(); fail("expected exception did not occur"); }
302303304305306307308309310311312
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeChar('A'); bm.reset(); bm.readChar(); // should throw bm.readChar(); fail("expected exception did not occur"); }
324325326327328329330331332333334
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeDouble(1.3d); bm.reset(); bm.readDouble(); // should throw bm.readDouble(); fail("expected exception did not occur"); }
346347348349350351352353354355356
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeFloat(1.3f); bm.reset(); bm.readFloat(); // should throw bm.readFloat(); fail("expected exception did not occur"); }
368369370371372373374375376377378
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeInt(99); bm.reset(); bm.readInt(); // should throw bm.readInt(); fail("expected exception did not occur"); }
390391392393394395396397398399400
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeLong(4L); bm.reset(); bm.readLong(); // should throw bm.readLong(); fail("expected exception did not occur"); }
412413414415416417418419420421422
{ try { JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage(); bm.writeShort((short)4); bm.reset(); bm.readShort(); // should throw bm.readShort(); fail("expected exception did not occur"); }