changeset 749:8d1fa0394251

ValueCoder refactored, OptionsListCoder
author Devel 1
date Tue, 12 Dec 2017 13:51:07 +0100
parents 92a55d662870
children 29f44148f245
files stress-tester/src/main/java/com/passus/st/reader/nc/option/DefaultValueCoder.java stress-tester/src/main/java/com/passus/st/reader/nc/option/OptionsListCoder.java stress-tester/src/main/java/com/passus/st/reader/nc/option/OptionsReaderWriter.java stress-tester/src/main/java/com/passus/st/reader/nc/option/ValueCoder.java stress-tester/src/main/java/com/passus/st/reader/nc/option/ValueCoders.java stress-tester/src/main/java/com/passus/st/reader/nc/option/VarOptionCoder.java stress-tester/src/test/java/com/passus/st/reader/nc/option/DefaultValueCoderTest.java stress-tester/src/test/java/com/passus/st/reader/nc/option/OptionsListCoderTest.java stress-tester/src/test/java/com/passus/st/reader/nc/option/OptionsReaderWriterTest.java stress-tester/src/test/java/com/passus/st/reader/nc/option/ValueCodersTest.java stress-tester/src/test/java/com/passus/st/reader/nc/option/VarOptionCoderTest.java
diffstat 11 files changed, 150 insertions(+), 456 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/option/DefaultValueCoder.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/option/DefaultValueCoder.java	Tue Dec 12 13:51:07 2017 +0100
@@ -4,7 +4,6 @@
 import com.passus.data.ByteString;
 import java.util.HashMap;
 import java.util.Map;
-import org.apache.commons.lang3.mutable.Mutable;
 
 /**
  *
@@ -83,22 +82,6 @@
         return coder.decode(buff);
     }
 
-    @Override
-    public int encode(byte[] bytes, int off, Object value) {
-        byte code = findCode(value);
-        bytes[off++] = code;
-        int written = CODE_TO_CODER[code].encode(bytes, off, value);
-        return written + 1;
-    }
-
-    @Override
-    public int decode(byte[] bytes, int off, Mutable value) {
-        byte code = bytes[off++];
-        ValueCoder coder = CODE_TO_CODER[code];
-        int read = coder.decode(bytes, off, value);
-        return read + 1;
-    }
-
     private static class NullCoder implements ValueCoder<Object> {
 
         @Override
@@ -110,15 +93,5 @@
             return null;
         }
 
-        @Override
-        public int encode(byte[] bytes, int off, Object value) {
-            return 0;
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<Object> value) {
-            value.setValue(null);
-            return 0;
-        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/option/OptionsListCoder.java	Tue Dec 12 13:51:07 2017 +0100
@@ -0,0 +1,61 @@
+package com.passus.st.reader.nc.option;
+
+import com.passus.data.ByteBuff;
+import com.passus.st.reader.nc.NcDataHelper;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class OptionsListCoder implements ValueCoder<List<Option>> {
+
+    private final NcDataHelper ncDataHelper = NcDataHelper.getInstance();
+
+    @Override
+    public void encode(List<Option> options, ByteBuff buff) {
+        ncDataHelper.writeIntVLC(buff, options.size());
+
+        for (Option option : options) {
+            String name = option.getName();
+            byte code = Options.getOptionCode(name);
+            ValueCoder coder = Options.getValueCoder(name);
+            if (coder == null) {
+                coder = DefaultValueCoder.INSTANCE;
+            }
+
+            buff.append(code);
+            if (code == 0) {
+                ncDataHelper.writeStringNullTerminated(buff, name);
+            }
+            coder.encode(option.getValue(), buff);
+        }
+    }
+
+    @Override
+    public List<Option> decode(ByteBuff buff) {
+        int numOptions = ncDataHelper.readIntVLC(buff);
+        List<Option> options = new ArrayList<>(numOptions);
+
+        for (int i = 0; i < numOptions; i++) {
+            byte code = buff.read();
+            String name;
+            if (code == 0) {
+                name = ncDataHelper.readStringNullTerminated(buff);
+            } else {
+                name = Options.getOptionName(code);
+            }
+
+            ValueCoder coder = Options.getValueCoder(name);
+            if (coder == null) {
+                coder = DefaultValueCoder.INSTANCE;
+            }
+
+            Object value = coder.decode(buff);
+            options.add(new Option(name, value));
+        }
+
+        return options;
+    }
+}
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/option/OptionsReaderWriter.java	Fri Dec 08 15:17:41 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-package com.passus.st.reader.nc.option;
-
-import com.passus.data.ByteBuff;
-import com.passus.st.reader.nc.NcDataHelper;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class OptionsReaderWriter {
-
-    private final NcDataHelper ncDataHelper = NcDataHelper.getInstance();
-
-    public void writeOptions(List<Option> options, ByteBuff buff) {
-        ncDataHelper.writeIntVLC(buff, options.size());
-
-        for (Option option : options) {
-            String name = option.getName();
-            byte code = Options.getOptionCode(name);
-            ValueCoder coder = Options.getValueCoder(name);
-            if (coder == null) {
-                coder = DefaultValueCoder.INSTANCE;
-            }
-
-            buff.append(code);
-            if (code == 0) {
-                ncDataHelper.writeStringNullTerminated(buff, name);
-            }
-            coder.encode(option.getValue(), buff);
-        }
-    }
-
-    public List<Option> readOptions(ByteBuff buff) {
-        int numOptions = ncDataHelper.readIntVLC(buff);
-        List<Option> options = new ArrayList<>(numOptions);
-
-        for (int i = 0; i < numOptions; i++) {
-            byte code = buff.read();
-            String name;
-            if (code == 0) {
-                name = ncDataHelper.readStringNullTerminated(buff);
-            } else {
-                name = Options.getOptionName(code);
-            }
-
-            ValueCoder coder = Options.getValueCoder(name);
-            if (coder == null) {
-                coder = DefaultValueCoder.INSTANCE;
-            }
-
-            Object value = coder.decode(buff);
-            options.add(new Option(name, value));
-        }
-
-        return options;
-    }
-}
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/option/ValueCoder.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/option/ValueCoder.java	Tue Dec 12 13:51:07 2017 +0100
@@ -1,8 +1,6 @@
 package com.passus.st.reader.nc.option;
 
 import com.passus.data.ByteBuff;
-import java.nio.ByteBuffer;
-import org.apache.commons.lang3.mutable.Mutable;
 
 /**
  *
@@ -11,10 +9,6 @@
  */
 public interface ValueCoder<T> {
 
-    public int encode(byte[] bytes, int off, T value);
-
-    public int decode(byte[] bytes, int off, Mutable<T> value);
-
     public void encode(T value, ByteBuff buff);
 
     public T decode(ByteBuff buff);
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/option/ValueCoders.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/option/ValueCoders.java	Tue Dec 12 13:51:07 2017 +0100
@@ -4,9 +4,6 @@
 import com.passus.data.ByteString;
 import com.passus.data.DataHelper;
 import com.passus.st.reader.nc.NcDataHelper;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableInt;
-import org.apache.commons.lang3.mutable.MutableLong;
 
 /**
  *
@@ -20,18 +17,6 @@
     public static class IntCoder implements ValueCoder<Integer> {
 
         @Override
-        public int encode(byte[] bytes, int off, Integer value) {
-            HELPER.writeInt4(bytes, off, value);
-            return 4;
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<Integer> value) {
-            value.setValue(HELPER.getInt4(bytes, off));
-            return 4;
-        }
-
-        @Override
         public void encode(Integer value, ByteBuff buff) {
             HELPER.writeInt4(buff, value);
         }
@@ -45,19 +30,6 @@
     public static class IntVlcCoder implements ValueCoder<Integer> {
 
         @Override
-        public int encode(byte[] bytes, int off, Integer value) {
-            return NC_HELPER.writeIntVLC(bytes, off, value);
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<Integer> value) {
-            MutableInt mi = new MutableInt();
-            int read = NC_HELPER.getIntVLC(bytes, off, bytes.length, mi);
-            value.setValue(mi.getValue());
-            return read;
-        }
-
-        @Override
         public void encode(Integer value, ByteBuff buff) {
             NC_HELPER.writeIntVLC(buff, value);
         }
@@ -71,18 +43,6 @@
     public static class LongCoder implements ValueCoder<Long> {
 
         @Override
-        public int encode(byte[] bytes, int off, Long value) {
-            HELPER.writeLong8(bytes, off, value);
-            return 8;
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<Long> value) {
-            value.setValue(HELPER.getLong8(bytes, off));
-            return 8;
-        }
-
-        @Override
         public void encode(Long value, ByteBuff buff) {
             HELPER.writeLong8(buff, value);
         }
@@ -96,19 +56,6 @@
     public static class LongVlcCoder implements ValueCoder<Long> {
 
         @Override
-        public int encode(byte[] bytes, int off, Long value) {
-            return NC_HELPER.writeLongVLC(bytes, off, value);
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<Long> value) {
-            MutableLong ml = new MutableLong();
-            int read = NC_HELPER.getLongVLC(bytes, off, bytes.length, ml);
-            value.setValue(ml.getValue());
-            return read;
-        }
-
-        @Override
         public void encode(Long value, ByteBuff buff) {
             NC_HELPER.writeLongVLC(buff, value);
         }
@@ -122,16 +69,6 @@
     public static class ByteStringNTCoder implements ValueCoder<ByteString> {
 
         @Override
-        public int encode(byte[] bytes, int off, ByteString value) {
-            return NC_HELPER.writeByteStringNullTerminated(bytes, off, bytes.length, value, true);
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<ByteString> value) {
-            return NC_HELPER.readByteStringNullTerminated(bytes, off, value);
-        }
-
-        @Override
         public void encode(ByteString value, ByteBuff buff) {
             NC_HELPER.writeByteStringNullTerminated(buff, value);
         }
@@ -145,16 +82,6 @@
     public static class StringNTCoder implements ValueCoder<String> {
 
         @Override
-        public int encode(byte[] bytes, int off, String value) {
-            return NC_HELPER.writeStringNullTerminated(bytes, off, bytes.length, value);
-        }
-
-        @Override
-        public int decode(byte[] bytes, int off, Mutable<String> value) {
-            return NC_HELPER.readStringNullTerminated(bytes, off, value);
-        }
-
-        @Override
         public void encode(String value, ByteBuff buff) {
             NC_HELPER.writeStringNullTerminated(buff, value);
         }
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/option/VarOptionCoder.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/option/VarOptionCoder.java	Tue Dec 12 13:51:07 2017 +0100
@@ -2,9 +2,6 @@
 
 import com.passus.data.ByteBuff;
 import com.passus.st.reader.nc.NcDataHelper;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableLong;
-import org.apache.commons.lang3.mutable.MutableObject;
 
 /**
  *
@@ -15,35 +12,6 @@
     public static NcDataHelper NC_HELPER = NcDataHelper.getInstance();
 
     @Override
-    public int encode(byte[] bytes, int off, VarOption value) {
-        int newOffset = off;
-        newOffset += NC_HELPER.writeStringNullTerminated(bytes, newOffset, bytes.length, value.getName());
-        newOffset += NC_HELPER.writeLongVLC(bytes, newOffset, value.getStartOffset());
-        newOffset += NC_HELPER.writeLongVLC(bytes, newOffset, value.getEndOffset());
-        return newOffset - off;
-    }
-
-    @Override
-    public int decode(byte[] bytes, int off, Mutable<VarOption> value) {
-        Mutable<String> ms = new MutableObject<>();
-        MutableLong ml = new MutableLong();
-        VarOption option = new VarOption();
-        int newOffset = off;
-
-        newOffset += NC_HELPER.readStringNullTerminated(bytes, off, ms);
-        option.setName(ms.getValue());
-
-        newOffset += NC_HELPER.getLongVLC(bytes, newOffset, bytes.length, ml);
-        option.setStartOffset(ml.getValue());
-
-        newOffset += NC_HELPER.getLongVLC(bytes, newOffset, bytes.length, ml);
-        option.setEndOffset(ml.getValue());
-
-        value.setValue(option);
-        return newOffset - off;
-    }
-
-    @Override
     public void encode(VarOption value, ByteBuff buff) {
         NC_HELPER.writeStringNullTerminated(buff, value.getName());
         NC_HELPER.writeLongVLC(buff, value.getStartOffset());
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/DefaultValueCoderTest.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/DefaultValueCoderTest.java	Tue Dec 12 13:51:07 2017 +0100
@@ -3,8 +3,6 @@
 import com.passus.commons.AsciiUtils;
 import com.passus.data.ByteString;
 import com.passus.data.HeapByteBuff;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 
@@ -15,22 +13,6 @@
 public class DefaultValueCoderTest {
 
     @Test
-    public void testConcreteClass_bytes() {
-        byte[] dst = {-1, -2, -3, -4, -5, -6, -7, -8};
-        String s = "abc";
-        byte[] encoded = {-1, DefaultValueCoder.STRING_CODE, 'a', 'b', 'c', AsciiUtils.NUL, -7, -8};
-        Mutable result = new MutableObject();
-
-        int n1 = DefaultValueCoder.INSTANCE.encode(dst, 1, s);
-        assertEquals(encoded, dst);
-        assertEquals(5, n1);
-
-        int n2 = DefaultValueCoder.INSTANCE.decode(encoded, 1, result);
-        assertEquals(s, result.getValue());
-        assertEquals(5, n2);
-    }
-
-    @Test
     public void testConcreteClass_ByteBuff() {
         HeapByteBuff buff = new HeapByteBuff(8);
         String s = "abc";
@@ -48,22 +30,6 @@
     }
 
     @Test
-    public void testAssignableClass_bytes() {
-        byte[] dst = {-1, -2, -3, -4, -5, -6, -7, -8};
-        ByteString bs = ByteString.create("abc");
-        byte[] encoded = {-1, DefaultValueCoder.BYTE_STRING_CODE, 'a', 'b', 'c', AsciiUtils.NUL, -7, -8};
-        Mutable result = new MutableObject();
-
-        int n1 = DefaultValueCoder.INSTANCE.encode(dst, 1, bs);
-        assertEquals(encoded, dst);
-        assertEquals(5, n1);
-
-        int n2 = DefaultValueCoder.INSTANCE.decode(encoded, 1, result);
-        assertEquals("abc", result.getValue().toString());
-        assertEquals(5, n2);
-    }
-
-    @Test
     public void testAssignableClass_ByteBuff() {
         HeapByteBuff buff = new HeapByteBuff(8);
         ByteString bs = ByteString.create("abc");
@@ -81,21 +47,6 @@
     }
 
     @Test
-    public void testNull_bytes() {
-        byte[] dst = {-1, -2, -3, -4};
-        byte[] encoded = {-1, DefaultValueCoder.NULL_CODE, -3, -4};
-        Mutable result = new MutableObject();
-
-        int n1 = DefaultValueCoder.INSTANCE.encode(dst, 1, null);
-        assertEquals(encoded, dst);
-        assertEquals(1, n1);
-
-        int n2 = DefaultValueCoder.INSTANCE.decode(encoded, 1, result);
-        assertEquals(null, result.getValue());
-        assertEquals(1, n2);
-    }
-
-    @Test
     public void testNull_ByteBuf() {
         HeapByteBuff buff = new HeapByteBuff(8);
 
@@ -112,11 +63,6 @@
     }
 
     @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testUnknownObjectType_bytes() {
-        DefaultValueCoder.INSTANCE.encode(null, 0, new Thread());
-    }
-
-    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testUnknownObjectType() {
         DefaultValueCoder.INSTANCE.encode(new Thread(), null);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/OptionsListCoderTest.java	Tue Dec 12 13:51:07 2017 +0100
@@ -0,0 +1,82 @@
+package com.passus.st.reader.nc.option;
+
+import com.passus.data.HeapByteBuff;
+import java.util.Arrays;
+import java.util.List;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class OptionsListCoderTest {
+
+    final byte opCode = 127;
+    final String opName = "xyz";
+    final Option op = new Option(opName, 123);
+    final List<Option> options = Arrays.asList(op, op);
+    final OptionsListCoder coder = new OptionsListCoder();
+
+    @Test
+    public void testOptionWithCode() {
+        Options.addOptionAndCoder(opName, opCode, ValueCoders.INT_CODER);
+        try {
+            HeapByteBuff buff = new HeapByteBuff();
+            coder.encode(options, buff);
+            byte[] result = buff.toArray();
+            byte[] expected = {
+                2,
+                127, 0, 0, 0, 123,
+                127, 0, 0, 0, 123
+            };
+            assertEquals(expected, result);
+
+            checkDecodedOptions(buff);
+        } finally {
+            Options.removeOptionAndCoder(opCode);
+        }
+    }
+
+    @Test
+    public void testOptionWithoutCode() {
+        Options.addCoder(opName, ValueCoders.INT_CODER);
+        try {
+            HeapByteBuff buff = new HeapByteBuff();
+            coder.encode(options, buff);
+            byte[] result = buff.toArray();
+            byte[] expected = {
+                2,
+                0, 'x', 'y', 'z', 0, 0, 0, 0, 123,
+                0, 'x', 'y', 'z', 0, 0, 0, 0, 123
+            };
+            assertEquals(expected, result);
+
+            checkDecodedOptions(buff);
+        } finally {
+            Options.removeCoder(opName);
+        }
+    }
+
+    @Test
+    public void testDefaultCoder() {
+        HeapByteBuff buff = new HeapByteBuff();
+        coder.encode(options, buff);
+        byte[] result = buff.toArray();
+        byte[] expected = {
+            2,
+            0, 'x', 'y', 'z', 0, DefaultValueCoder.INT_CODE, 0, 0, 0, 123,
+            0, 'x', 'y', 'z', 0, DefaultValueCoder.INT_CODE, 0, 0, 0, 123
+        };
+        assertEquals(expected, result);
+
+        checkDecodedOptions(buff);
+    }
+
+    private void checkDecodedOptions(HeapByteBuff buff) {
+        List<Option> options = coder.decode(buff);
+        assertEquals(2, options.size());
+        assertEquals(opName, options.get(0).getName());
+        assertEquals(123, options.get(0).getValue());
+    }
+}
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/OptionsReaderWriterTest.java	Fri Dec 08 15:17:41 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-package com.passus.st.reader.nc.option;
-
-import com.passus.data.HeapByteBuff;
-import java.util.Arrays;
-import java.util.List;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class OptionsReaderWriterTest {
-
-    final byte opCode = 127;
-    final String opName = "xyz";
-    final Option op = new Option(opName, 123);
-    final List<Option> options = Arrays.asList(op, op);
-    final OptionsReaderWriter rw = new OptionsReaderWriter();
-
-    @Test
-    public void testOptionWithCode() {
-        Options.addOptionAndCoder(opName, opCode, ValueCoders.INT_CODER);
-        try {
-            HeapByteBuff buff = new HeapByteBuff();
-            rw.writeOptions(options, buff);
-            byte[] result = buff.toArray();
-            byte[] expected = {
-                2,
-                127, 0, 0, 0, 123,
-                127, 0, 0, 0, 123
-            };
-            assertEquals(expected, result);
-
-            checkDecodedOptions(buff);
-        } finally {
-            Options.removeOptionAndCoder(opCode);
-        }
-    }
-
-    @Test
-    public void testOptionWithoutCode() {
-        Options.addCoder(opName, ValueCoders.INT_CODER);
-        try {
-            HeapByteBuff buff = new HeapByteBuff();
-            rw.writeOptions(options, buff);
-            byte[] result = buff.toArray();
-            byte[] expected = {
-                2,
-                0, 'x', 'y', 'z', 0, 0, 0, 0, 123,
-                0, 'x', 'y', 'z', 0, 0, 0, 0, 123
-            };
-            assertEquals(expected, result);
-
-            checkDecodedOptions(buff);
-        } finally {
-            Options.removeCoder(opName);
-        }
-    }
-
-    @Test
-    public void testDefaultCoder() {
-        HeapByteBuff buff = new HeapByteBuff();
-        rw.writeOptions(options, buff);
-        byte[] result = buff.toArray();
-        byte[] expected = {
-            2,
-            0, 'x', 'y', 'z', 0, DefaultValueCoder.INT_CODE, 0, 0, 0, 123,
-            0, 'x', 'y', 'z', 0, DefaultValueCoder.INT_CODE, 0, 0, 0, 123
-        };
-        assertEquals(expected, result);
-
-        checkDecodedOptions(buff);
-    }
-
-    private void checkDecodedOptions(HeapByteBuff buff) {
-        List<Option> options = rw.readOptions(buff);
-        assertEquals(2, options.size());
-        assertEquals(opName, options.get(0).getName());
-        assertEquals(123, options.get(0).getValue());
-    }
-}
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/ValueCodersTest.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/ValueCodersTest.java	Tue Dec 12 13:51:07 2017 +0100
@@ -1,11 +1,8 @@
 package com.passus.st.reader.nc.option;
 
-import com.passus.commons.AsciiUtils;
 import com.passus.data.ByteBuff;
 import com.passus.data.ByteString;
 import com.passus.data.HeapByteBuff;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 
@@ -16,21 +13,6 @@
 public class ValueCodersTest {
 
     @Test
-    public void testIntCoder_bytes() {
-        byte[] dst = new byte[8];
-        byte[] encoded = {0, 0, 0, 0, 0, 123, 0, 0};
-        Mutable<Integer> result = new MutableObject<>();
-
-        int n1 = ValueCoders.INT_CODER.encode(dst, 2, 123);
-        assertEquals(encoded, dst);
-        assertEquals(4, n1);
-
-        int n2 = ValueCoders.INT_CODER.decode(dst, 2, result);
-        assertEquals(123, result.getValue().intValue());
-        assertEquals(4, n2);
-    }
-
-    @Test
     public void testIntCoder_ByteBuff() {
         ByteBuff buff = new HeapByteBuff(8);
 
@@ -47,21 +29,6 @@
     }
 
     @Test
-    public void testIntVlcCoder_bytes() {
-        byte[] dst = new byte[6];
-        byte[] encoded = {0, 0, 123, 0, 0, 0};
-        Mutable<Integer> result = new MutableObject<>();
-
-        int n1 = ValueCoders.INT_VLC_CODER.encode(dst, 2, 123);
-        assertEquals(encoded, dst);
-        assertEquals(1, n1);
-
-        int n2 = ValueCoders.INT_VLC_CODER.decode(dst, 2, result);
-        assertEquals(123, result.getValue().intValue());
-        assertEquals(1, n2);
-    }
-
-    @Test
     public void testIntVlcCoder_ByteBuff() {
         ByteBuff buff = new HeapByteBuff(8);
 
@@ -78,21 +45,6 @@
     }
 
     @Test
-    public void testLongCoder_bytes() {
-        byte[] dst = new byte[12];
-        byte[] encoded = {0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 0, 0};
-        Mutable<Long> result = new MutableObject<>();
-
-        int n1 = ValueCoders.LONG_CODER.encode(dst, 2, 123L);
-        assertEquals(encoded, dst);
-        assertEquals(8, n1);
-
-        int n2 = ValueCoders.LONG_CODER.decode(dst, 2, result);
-        assertEquals(123, result.getValue().intValue());
-        assertEquals(8, n2);
-    }
-
-    @Test
     public void testLongCoder_ByteBuff() {
         ByteBuff buff = new HeapByteBuff(12);
 
@@ -109,21 +61,6 @@
     }
 
     @Test
-    public void testLongVlcCoder_bytes() {
-        byte[] dst = new byte[6];
-        byte[] encoded = {0, 0, 0, 123, 0, 0};
-        Mutable<Long> result = new MutableObject<>();
-
-        int n1 = ValueCoders.LONG_VLC_CODER.encode(dst, 2, 123L);
-        assertEquals(encoded, dst);
-        assertEquals(2, n1);
-
-        int n2 = ValueCoders.LONG_VLC_CODER.decode(dst, 2, result);
-        assertEquals(123, result.getValue().intValue());
-        assertEquals(2, n2);
-    }
-
-    @Test
     public void testLongVlcCoder_ByteBuff() {
         ByteBuff buff = new HeapByteBuff(8);
 
@@ -140,22 +77,6 @@
     }
 
     @Test
-    public void testByteStringNTCoder_bytes() {
-        byte[] dst = new byte[8];
-        ByteString bs = ByteString.create("12\n45");
-        byte[] encoded = {0, '1', '2', '\n', '4', '5', AsciiUtils.NUL, 0};
-        Mutable<ByteString> result = new MutableObject<>();
-
-        int n1 = ValueCoders.BYTE_STRING_NT_CODER.encode(dst, 1, bs);
-        assertEquals(encoded, dst);
-        assertEquals(6, n1);
-
-        int n2 = ValueCoders.BYTE_STRING_NT_CODER.decode(encoded, 1, result);
-        assertEquals("12\n45", result.getValue().toString());
-        assertEquals(6, n2);
-    }
-
-    @Test
     public void testByteStringNTCoder_ByteBuff() {
         ByteBuff buff = new HeapByteBuff(8);
         ByteString bs = ByteString.create("12\n45");
@@ -173,22 +94,6 @@
     }
 
     @Test
-    public void testStringNTCoder_bytes() {
-        byte[] dst = new byte[8];
-        String bs = "12\n45";
-        byte[] encoded = {0, '1', '2', '\n', '4', '5', AsciiUtils.NUL, 0};
-        Mutable<String> result = new MutableObject<>();
-
-        int n1 = ValueCoders.STRING_NT_CODER.encode(dst, 1, bs);
-        assertEquals(encoded, dst);
-        assertEquals(6, n1);
-
-        int n2 = ValueCoders.STRING_NT_CODER.decode(encoded, 1, result);
-        assertEquals("12\n45", result.getValue());
-        assertEquals(6, n2);
-    }
-
-    @Test
     public void testStringNTCoder_ByteBuff() {
         ByteBuff buff = new HeapByteBuff(8);
 
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/VarOptionCoderTest.java	Fri Dec 08 15:17:41 2017 +0100
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/VarOptionCoderTest.java	Tue Dec 12 13:51:07 2017 +0100
@@ -2,8 +2,6 @@
 
 import com.passus.commons.AsciiUtils;
 import com.passus.data.HeapByteBuff;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 
@@ -12,53 +10,34 @@
  * @author mikolaj.podbielski
  */
 public class VarOptionCoderTest {
-    
+
     VarOptionCoder coder = new VarOptionCoder();
-    
-    @Test
-    public void testEncodeDecode_bytes() {
-        VarOption vo = new VarOption("user", 120, 140); // 5B + 2B + 2B
-        byte[] encoded = {0, 'u', 's', 'e', 'r', AsciiUtils.NUL, 0, 120, 0, (byte) 140, 0, 0};
-        byte[] dst = new byte[12];
-        Mutable<VarOption> result = new MutableObject<>();
-        
-        int n1 = coder.encode(dst, 1, vo);
-        assertEquals(encoded, dst);
-        assertEquals(9, n1);
-        
-        int n2 = coder.decode(encoded, 1, result);
-        VarOption value = result.getValue();
-        assertEquals(value.getName(), "user");
-        assertEquals(value.getStartOffset(), 120);
-        assertEquals(value.getEndOffset(), 140);
-        assertEquals(9, n2);
-    }
-    
+
     @Test
     public void testEncode_ByteBuff() {
         VarOption vo = new VarOption("user", 120, 140); // 5B + 2B + 2B
         HeapByteBuff dst = new HeapByteBuff();
         coder.encode(vo, dst);
-        
+
         byte[] expected = {'u', 's', 'e', 'r', AsciiUtils.NUL, 0, 120, 0, (byte) 140};
         assertEquals(0, dst.startIndex());
         assertEquals(9, dst.endIndex());
         assertEquals(expected, dst.toArray());
     }
-    
+
     @Test
     public void testDecode_ByteBuff() {
         byte[] zeros = new byte[4];
         byte[] expected = {'u', 's', 'e', 'r', 0, 0, 120, 0, (byte) 140};
-        
+
         HeapByteBuff src = new HeapByteBuff();
         src.append(zeros);
         src.append(expected);
         src.append(zeros);
         src.skipBytes(zeros.length);
-        
+
         VarOption vo = coder.decode(src);
-        
+
         assertEquals("user", vo.getName());
         assertEquals(120, vo.getStartOffset());
         assertEquals(140, vo.getEndOffset());