org.exolab.jmscts.test.message.bytes
Class BytesMessageTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.exolab.jmscts.core.JMSTestCase
                    |
                    +--org.exolab.jmscts.core.AbstractConnectionFactoryTestCase
                          |
                          +--org.exolab.jmscts.core.AbstractConnectionTestCase
                                |
                                +--org.exolab.jmscts.core.AbstractSessionTestCase
                                      |
                                      +--org.exolab.jmscts.core.AbstractMessageTestCase
                                            |
                                            +--org.exolab.jmscts.test.message.bytes.BytesMessageTest
All Implemented Interfaces:
ConnectionFactoryTestCase, ConnectionTestCase, JMSTest, MessageTestCase, MessageValues, PropertyValues, SessionTestCase, junit.framework.Test

public class BytesMessageTest
extends AbstractMessageTestCase
implements MessageValues

This class tests the BytesMessage message type.

Version:
$Revision: 1.8 $
Author:
Tim Anderson
See Also:
BytesMessage, AbstractMessageTestCase

Fields inherited from interface org.exolab.jmscts.test.message.util.MessageValues
ALL_VALUES, BYTE_ARRAYS, CHARS
 
Fields inherited from interface org.exolab.jmscts.test.message.util.PropertyValues
BOOLEANS, BYTES, DOUBLES, FLOATS, INTS, LONGS, SHORTS, STRINGS
 
Constructor Summary
BytesMessageTest(java.lang.String name)
          Construct a new BytesMessageTest
 
Method Summary
 MessagePopulator getMessagePopulator()
          Get the message populator.
static junit.framework.Test suite()
          Sets up the test suite
 void testInvalidObject()
          Verifies that attempting to write an invalid object using the BytesMessage.writeObject() method throws MessageFormatException
 void testPartialReadBytes1()
          Verifies that the BytesMessage.readBytes(byte[], int) method can be called multiple times passing a byte array less than the length of the byte stream, and that the result matches that expected.
 void testPartialReadBytes2()
          Verifies that the BytesMessage.readBytes(byte[], int) method can be called multiple times passing a length parameter less than the length of the array, and that the result matches that expected.
 void testReadBytes()
          Verifies the behaviour of the BytesMessage.readBytes(byte[]) method.
 void testReadBytesForEmptyStream1()
          Verifies that the BytesMessage.readBytes(byte[]) method returns -1 to indicate end-of-stream, for an empty message body.
 void testReadBytesForEmptyStream2()
          Verifies that the BytesMessage.readBytes(byte[], int) method returns -1 to indicate end-of-stream, for an empty message body.
 void testReadBytesIndexException()
          Verifies that the BytesMessage.readBytes(byte[], int) method throws IndexOutOfBoundsException for invalid length parameters
 void testReadFailure()
          Verifies that if a read method throws MessageFormatException or NumberFormatException, the current position of the read pointer is not be incremented, and that a subsequent read is capable of recovering from the exception by re-reading the data as a different type.
NOTE: With the exception of the readUTF() method, it is difficult to conceive test cases for read methods.
 void testWriteObject()
          Verfies that all objectified primitives can be written using the BytesMessage.writeObject() method
 
Methods inherited from class org.exolab.jmscts.core.AbstractMessageTestCase
getMessageTypes, shouldCreateMessage, startConnection
 
Methods inherited from class org.exolab.jmscts.core.AbstractSessionTestCase
getAckTypes
 
Methods inherited from class org.exolab.jmscts.core.AbstractConnectionTestCase
setClientID
 
Methods inherited from class org.exolab.jmscts.core.AbstractConnectionFactoryTestCase
getConnectionFactoryTypes
 
Methods inherited from class org.exolab.jmscts.core.JMSTestCase
getContext, getRequirements, setContext, share
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.exolab.jmscts.core.SessionTestCase
getAckTypes
 
Methods inherited from interface org.exolab.jmscts.core.ConnectionTestCase
setClientID
 
Methods inherited from interface org.exolab.jmscts.core.ConnectionFactoryTestCase
getConnectionFactoryTypes
 
Methods inherited from interface org.exolab.jmscts.core.JMSTest
getContext, setContext, share
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Constructor Detail

BytesMessageTest

public BytesMessageTest(java.lang.String name)
Construct a new BytesMessageTest
Parameters:
name - the name of test case
Method Detail

suite

public static junit.framework.Test suite()
Sets up the test suite
Returns:
an instance of this class that may be run by JMSTestRunner

getMessagePopulator

public MessagePopulator getMessagePopulator()
Get the message populator. This implementation always returns null
Overrides:
getMessagePopulator in class AbstractMessageTestCase
Returns:
null

testReadFailure

public void testReadFailure()
                     throws java.lang.Exception
Verifies that if a read method throws MessageFormatException or NumberFormatException, the current position of the read pointer is not be incremented, and that a subsequent read is capable of recovering from the exception by re-reading the data as a different type.
NOTE: With the exception of the readUTF() method, it is difficult to conceive test cases for read methods.
Throws:
java.lang.Exception - for any error

testReadBytesForEmptyStream1

public void testReadBytesForEmptyStream1()
                                  throws java.lang.Exception
Verifies that the BytesMessage.readBytes(byte[]) method returns -1 to indicate end-of-stream, for an empty message body.
Throws:
java.lang.Exception - for any error

testReadBytesForEmptyStream2

public void testReadBytesForEmptyStream2()
                                  throws java.lang.Exception
Verifies that the BytesMessage.readBytes(byte[], int) method returns -1 to indicate end-of-stream, for an empty message body.
Throws:
java.lang.Exception - for any error

testReadBytes

public void testReadBytes()
                   throws java.lang.Exception
Verifies the behaviour of the BytesMessage.readBytes(byte[]) method.
Throws:
java.lang.Exception - for any error

testPartialReadBytes1

public void testPartialReadBytes1()
                           throws java.lang.Exception
Verifies that the BytesMessage.readBytes(byte[], int) method can be called multiple times passing a byte array less than the length of the byte stream, and that the result matches that expected.
Throws:
java.lang.Exception - for any error

testPartialReadBytes2

public void testPartialReadBytes2()
                           throws java.lang.Exception
Verifies that the BytesMessage.readBytes(byte[], int) method can be called multiple times passing a length parameter less than the length of the array, and that the result matches that expected.
Throws:
java.lang.Exception - for any error

testReadBytesIndexException

public void testReadBytesIndexException()
                                 throws java.lang.Exception
Verifies that the BytesMessage.readBytes(byte[], int) method throws IndexOutOfBoundsException for invalid length parameters
Throws:
java.lang.Exception - for any error

testWriteObject

public void testWriteObject()
                     throws java.lang.Exception
Verfies that all objectified primitives can be written using the BytesMessage.writeObject() method
Throws:
java.lang.Exception - for any error

testInvalidObject

public void testInvalidObject()
                       throws java.lang.Exception
Verifies that attempting to write an invalid object using the BytesMessage.writeObject() method throws MessageFormatException
Throws:
java.lang.Exception - for any error


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.