    1   /*
    2    * Created on Mar 4, 2004
    3    *
    4    * To change the template for this generated file go to
    5    * Window - Preferences - Java - Code Generation - Code and Comments
    6    */
    7   package org.codehaus.activemq.message;
    8
    9   import junit.framework.TestCase;
    10
    11  import javax.jms.JMSException;
    12
    13  /***
    14   * @version $Revision: 1.2 $
    15   */
    16  public class ActiveMQObjectMessageTest extends TestCase {
    17
    18      public static void main(String[] args) {
    19          junit.textui.TestRunner.run(ActiveMQObjectMessageTest.class);
    20      }
    21
    22      /*
    23       * @see TestCase#setUp()
    24       */
    25      protected void setUp() throws Exception {
    26          super.setUp();
    27      }
    28
    29      /*
    30       * @see TestCase#tearDown()
    31       */
    32      protected void tearDown() throws Exception {
    33          super.tearDown();
    34      }
    35
    36      /***
    37       * Constructor for ActiveMQObjectMessageTest.
    38       *
    39       * @param arg0
    40       */
    41      public ActiveMQObjectMessageTest(String arg0) {
    42          super(arg0);
    43      }
    44
    45      public void testGetPacketType() {
    46          ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
    47          assertTrue(msg.getPacketType() == Packet.ACTIVEMQ_OBJECT_MESSAGE);
    48      }
    49
    50      public void testSetObject() {
    51          ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
    52          String str = "testText";
    53          try {
    54              msg.setObject(str);
    55              assertTrue(msg.getObject() == str);
    56          }
    57          catch (JMSException e) {
    58              e.printStackTrace();
    59          }
    60          boolean readOnlyTest = false;
    61          msg.setReadOnly(true);
    62          try {
    63              msg.setObject(str);
    64          }
    65          catch (JMSException e) {
    66              readOnlyTest = true;
    67          }
    68          assertTrue(readOnlyTest);
    69      }
    70
    71
    72  }