use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testString.
@Test
public void testString() throws Exception {
String value = RandomUtil.randomString();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeString(value);
message.reset();
try {
message.readByte();
fail("must throw a NumberFormatException");
} catch (NumberFormatException e) {
}
// we can read the String without resetting the message
Assert.assertEquals(value, message.readString());
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadFloatFromFloat.
@Test
public void testReadFloatFromFloat() throws Exception {
float value = RandomUtil.randomFloat();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeFloat(value);
message.reset();
Assert.assertEquals(value, message.readFloat(), 0.000001);
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadObjectFromChar.
@Test
public void testReadObjectFromChar() throws Exception {
char value = RandomUtil.randomChar();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeChar(value);
message.reset();
Assert.assertEquals(value, message.readObject());
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadStringFromInt.
@Test
public void testReadStringFromInt() throws Exception {
int value = RandomUtil.randomInt();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeInt(value);
message.reset();
Assert.assertEquals(Integer.toString(value), message.readString());
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadObjectFromBoolean.
@Test
public void testReadObjectFromBoolean() throws Exception {
boolean value = RandomUtil.randomBoolean();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeBoolean(value);
message.reset();
Assert.assertEquals(value, message.readObject());
}
Aggregations