use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadLongFromInt.
@Test
public void testReadLongFromInt() throws Exception {
int value = RandomUtil.randomInt();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeInt(value);
message.reset();
Assert.assertEquals(value, message.readLong());
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadObjectFromString.
@Test
public void testReadObjectFromString() throws Exception {
String value = RandomUtil.randomString();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeString(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 testReadCharFromNull.
@Test
public void testReadCharFromNull() throws Exception {
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeString(null);
message.reset();
try {
message.readChar();
fail();
} catch (NullPointerException e) {
}
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testReadDoubleFromString.
@Test
public void testReadDoubleFromString() throws Exception {
double value = RandomUtil.randomDouble();
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.writeString(Double.toString(value));
message.reset();
Assert.assertEquals(value, message.readDouble(), 0.000001);
}
use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.
the class ActiveMQStreamMessageTest method testWriteObjectWithInvalidType.
@Test
public void testWriteObjectWithInvalidType() throws Exception {
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
try {
message.writeObject(new ArrayList<String>());
Assert.fail("MessageFormatException");
} catch (MessageFormatException e) {
}
}
Aggregations