You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2006/06/21 04:51:55 UTC

svn commit: r415876 - /directory/trunks/mina/core/src/test/java/org/apache/mina/common/ByteBufferTest.java

Author: trustin
Date: Tue Jun 20 19:51:54 2006
New Revision: 415876

URL: http://svn.apache.org/viewvc?rev=415876&view=rev
Log:
Added a test case for ByteBuffer.getUnsigned*()

Modified:
    directory/trunks/mina/core/src/test/java/org/apache/mina/common/ByteBufferTest.java

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/common/ByteBufferTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/test/java/org/apache/mina/common/ByteBufferTest.java?rev=415876&r1=415875&r2=415876&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/common/ByteBufferTest.java (original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/common/ByteBufferTest.java Tue Jun 20 19:51:54 2006
@@ -22,6 +22,7 @@
 import junit.framework.TestCase;
 
 import java.nio.BufferOverflowException;
+import java.nio.ByteOrder;
 import java.nio.ReadOnlyBufferException;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
@@ -777,5 +778,24 @@
         {
             // OK
         }
+    }
+    
+    public void testGetUnsigned() throws Exception
+    {
+        ByteBuffer buf = ByteBuffer.allocate( 16 );
+        buf.put( ( byte ) 0xA4 );
+        buf.put( ( byte ) 0xD0 );
+        buf.put( ( byte ) 0xB3 );
+        buf.put( ( byte ) 0xCD );
+        buf.flip();
+        
+        buf.order( ByteOrder.LITTLE_ENDIAN );
+        
+        buf.mark();
+        Assert.assertEquals( 0xA4, buf.getUnsigned() );
+        buf.reset();
+        Assert.assertEquals( 0xD0A4, buf.getUnsignedShort() );
+        buf.reset();
+        Assert.assertEquals( 0xCDB3D0A4L, buf.getUnsignedInt() );
     }
 }