From 7cecf190a22f70317bc8f79b2770c04565d3ee84 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Thu, 22 Jul 2010 14:21:47 +0000 Subject: QPID-2744 : Add tests for correct exception when null object is set via setObjectProperty in Field Table and via JMS Properties git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@966680 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/framing/PropertyFieldTableTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'qpid/java/common/src/test') diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java index 007da7423e..66ca43c145 100644 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java +++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java @@ -25,6 +25,7 @@ import junit.framework.TestCase; import org.apache.mina.common.ByteBuffer; +import org.apache.qpid.AMQInvalidArgumentException; import org.apache.qpid.AMQPInvalidClassException; import org.slf4j.Logger; @@ -520,6 +521,18 @@ public class PropertyFieldTableTest extends TestCase table.setObject("object-short", Short.MAX_VALUE); table.setObject("object-string", "Hello"); + try + { + table.setObject("Null-object", null); + fail("null values are not allowed"); + } + catch (AMQPInvalidClassException aice) + { + assertEquals("Null values are not allowed to be set", + "Only Primitives objects allowed Object is:null", aice.getMessage()); + } + + Assert.assertEquals((Boolean) true, table.getBoolean("bool")); Assert.assertEquals((Byte) Byte.MAX_VALUE, table.getByte("byte")); assertBytesEqual(bytes, table.getBytes("bytes")); -- cgit v1.2.1