cvs commit: spice/sandbox/packet/src/test/org/realityforge/packet PacketTestCase.java
Peter Donald <[email protected]> Mon, 10 Nov 2003 20:20:49 -0800
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
donaldp 03/11/10 20:20:48
Added: sandbox/packet/src/test/org/realityforge/packet
PacketTestCase.java
Log:
Add in packet test case
Revision Changes Path
1.1 spice/sandbox/packet/src/test/org/realityforge/packet/PacketTestCase.java
Index: PacketTestCase.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.realityforge.packet;
import junit.framework.TestCase;
import java.nio.ByteBuffer;
/**
*
* @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
* @version $Revision: 1.1 $ $Date: 2003/11/11 04:20:48 $
*/
public class PacketTestCase
extends TestCase
{
public void testPacket()
throws Exception
{
final ByteBuffer data = ByteBuffer.allocate( 3 );
final Packet packet = new Packet( 2, 3, data );
assertEquals( "sequence", 2, packet.getSequence() );
assertEquals( "flags", 3, packet.getFlags() );
assertEquals( "data", data, packet.getData() );
}
public void testNullDataPassedToCtor()
throws Exception
{
try
{
new Packet( 2, 2, null );
}
catch( final NullPointerException npe )
{
assertEquals( "npe.getMessage()", "data", npe.getMessage() );
return;
}
fail( "Expected to fail due to null Data passed into Ctor" );
}
}
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/