changeset 762:6bb60e93eb43

ValueCodersTest
author Devel 1
date Fri, 15 Dec 2017 11:30:43 +0100
parents 42eb8a0fd8c0
children cb51fb3a6ebd
files stress-tester/src/test/java/com/passus/st/reader/nc/option/ValueCodersTest.java
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/ValueCodersTest.java	Fri Dec 15 11:12:36 2017 +0100
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/ValueCodersTest.java	Fri Dec 15 11:30:43 2017 +0100
@@ -17,10 +17,10 @@
         ByteBuff buff = new HeapByteBuff(8);
 
         ValueCoders.INT_CODER.encode(123, buff);
-        byte[] expected = {0, 0, 0, 123, 0, 0, 0, 0};
+        byte[] expected = {0, 0, 0, 123};
         assertEquals(0, buff.startIndex());
         assertEquals(4, buff.endIndex());
-        assertEquals(expected, buff.buffer());
+        assertEquals(expected, buff.toArray());
 
         int value = ValueCoders.INT_CODER.decode(buff);
         assertEquals(4, buff.startIndex());
@@ -33,10 +33,10 @@
         ByteBuff buff = new HeapByteBuff(8);
 
         ValueCoders.INT_VLC_CODER.encode(123, buff);
-        byte[] expected = {123, 0, 0, 0, 0, 0, 0, 0};
+        byte[] expected = {123};
         assertEquals(0, buff.startIndex());
         assertEquals(1, buff.endIndex());
-        assertEquals(expected, buff.buffer());
+        assertEquals(expected, buff.toArray());
 
         int value = ValueCoders.INT_VLC_CODER.decode(buff);
         assertEquals(1, buff.startIndex());
@@ -49,10 +49,10 @@
         ByteBuff buff = new HeapByteBuff(12);
 
         ValueCoders.LONG_CODER.encode(123L, buff);
-        byte[] expected = {0, 0, 0, 0, 0, 0, 0, 123, 0, 0, 0, 0};
+        byte[] expected = {0, 0, 0, 0, 0, 0, 0, 123};
         assertEquals(0, buff.startIndex());
         assertEquals(8, buff.endIndex());
-        assertEquals(expected, buff.buffer());
+        assertEquals(expected, buff.toArray());
 
         long value = ValueCoders.LONG_CODER.decode(buff);
         assertEquals(8, buff.startIndex());
@@ -62,13 +62,13 @@
 
     @Test
     public void testLongVlcCoder_ByteBuff() {
-        ByteBuff buff = new HeapByteBuff(8);
+        ByteBuff buff = new HeapByteBuff(10);
 
         ValueCoders.LONG_VLC_CODER.encode(123L, buff);
-        byte[] expected = {0, 123, 0, 0, 0, 0, 0, 0};
+        byte[] expected = {0, 123};
         assertEquals(0, buff.startIndex());
         assertEquals(2, buff.endIndex());
-        assertEquals(expected, buff.buffer());
+        assertEquals(expected, buff.toArray());
 
         long value = ValueCoders.LONG_VLC_CODER.decode(buff);
         assertEquals(2, buff.startIndex());
@@ -82,10 +82,10 @@
         ByteString bs = ByteString.create("12\n45");
 
         ValueCoders.BYTE_STRING_NT_CODER.encode(bs, buff);
-        byte[] expected = {'1', '2', '\n', '4', '5', 0, 0, 0};
+        byte[] expected = {'1', '2', '\n', '4', '5', 0};
         assertEquals(0, buff.startIndex());
         assertEquals(6, buff.endIndex());
-        assertEquals(expected, buff.buffer());
+        assertEquals(expected, buff.toArray());
 
         ByteString value = ValueCoders.BYTE_STRING_NT_CODER.decode(buff);
         assertEquals(6, buff.startIndex());
@@ -98,10 +98,10 @@
         ByteBuff buff = new HeapByteBuff(8);
 
         ValueCoders.STRING_NT_CODER.encode("ąć", buff);
-        byte[] expected = {(byte) 0xc4, (byte) 0x85, (byte) 0xc4, (byte) 0x87, 0, 0, 0, 0};
+        byte[] expected = {(byte) 0xc4, (byte) 0x85, (byte) 0xc4, (byte) 0x87, 0};
         assertEquals(0, buff.startIndex());
         assertEquals(5, buff.endIndex());
-        assertEquals(expected, buff.buffer());
+        assertEquals(expected, buff.toArray());
 
         String value = ValueCoders.STRING_NT_CODER.decode(buff);
         assertEquals(5, buff.startIndex());