qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: Cover JMSException thrown when encoding doesn't match default UTF-8
Date Thu, 09 Oct 2014 14:42:12 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 04f7d6dc8 -> b07c7faac


Cover JMSException thrown when encoding doesn't match default UTF-8

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/b07c7faa
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/b07c7faa
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/b07c7faa

Branch: refs/heads/master
Commit: b07c7faacb5f6ba81714ca3c3a85fa6c88c7defe
Parents: 04f7d6d
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu Oct 9 10:41:50 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu Oct 9 10:41:50 2014 -0400

----------------------------------------------------------------------
 .../message/AmqpJmsTextMessageFacadeTest.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b07c7faa/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsTextMessageFacadeTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsTextMessageFacadeTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsTextMessageFacadeTest.java
index 0747d77..d7cecca 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsTextMessageFacadeTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsTextMessageFacadeTest.java
@@ -30,6 +30,8 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Map;
 
+import javax.jms.JMSException;
+
 import org.apache.qpid.jms.test.testpeer.describedtypes.sections.DataDescribedType;
 import org.apache.qpid.proton.amqp.Binary;
 import org.apache.qpid.proton.amqp.Symbol;
@@ -240,4 +242,21 @@ public class AmqpJmsTextMessageFacadeTest extends AmqpJmsMessageTypesTestCase
{
             // expected
         }
     }
+
+    @Test
+    public void testGetTextWithUnknownEncodedDataThrowsJMSException() throws Exception {
+        String encodedString = "myEncodedString";
+        byte[] encodedBytes = encodedString.getBytes(Charset.forName("UTF-16"));
+
+        Message message = Message.Factory.create();
+        message.setBody(new Data(new Binary(encodedBytes)));
+        AmqpJmsTextMessageFacade amqpTextMessageFacade = createReceivedTextMessageFacade(createMockAmqpConsumer(),
message);
+
+        try {
+            amqpTextMessageFacade.getText();
+            fail("expected exception not thrown");
+        } catch (JMSException ise) {
+            // expected
+        }
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message