  protected JBBPDslBuilder addAnnotatedClass(final Class<?> annotatedClass, final boolean onlyFields) {
    final BinFieldContainer collected = collectAnnotatedFields(annotatedClass);

    final JBBPByteOrder old = this.byteOrder;
    this.byteOrder = JBBPByteOrder.BIG_ENDIAN;

    class Pair {
      final BinFieldContainer container;
      final Iterator<BinField> iter;

      Pair(final BinFieldContainer container) {
        this.container = container;
        this.iter = container.fields.iterator();
      }
    }

    if (onlyFields) {
      int indexOfLastEndStruct = -1;
      for (int i = collected.fields.size() - 1; i >= 0; i--) {
        if (collected.fields.get(i) == BinFieldContainer.END_STRUCT) {
          indexOfLastEndStruct = i;
          break;
        }
      }
      if (indexOfLastEndStruct >= 0) {
        collected.fields.remove(indexOfLastEndStruct);
      } else {
        throw new IllegalStateException("Can't find end of structure");
      }
    } else {
      this.Struct(collected.getName());
    }

    final List<Pair> stack = new ArrayList<>();
    stack.add(new Pair(collected));

    while (!stack.isEmpty()) {
      final Pair pair = stack.remove(0);
      while (pair.iter.hasNext()) {
        final BinField field = pair.iter.next();
        if (field instanceof BinFieldContainer) {
          final BinFieldContainer conty = (BinFieldContainer) field;
          if (conty == BinFieldContainer.END_STRUCT) {
            this.CloseStruct();
          } else {
            if (field.isArrayField()) {
              this.StructArray(conty.getName(), conty.bin.extra());
            } else {
              this.Struct(conty.getName());
            }
            stack.add(0, pair);
            stack.add(0, new Pair(conty));
            break;
          }
        } else {
          if (field.isCustomBin()) {
            this.ByteOrder(pair.container.getByteOrder(field));
            if (field.isArrayField() || field.binCustom.arraySizeExpression().length() > 0) {
              this.CustomArray(field.binCustom.type(), field.getName(), field.binCustom.arraySizeExpression(), field.binCustom.extraExpression());
            } else {
              this.Custom(field.binCustom.type(), field.getName(), field.binCustom.extraExpression());
            }
          } else {
            final BinType type = field.findType();
            this.ByteOrder(pair.container.getByteOrder(field));
            switch (type) {
              case BIT_ARRAY: {
                this.BitArray(field.getName(), pair.container.getBitNumber(field), field.bin.extra());
              }
              break;
              case BIT: {
                this.Bits(field.getName(), pair.container.getBitNumber(field));
              }
              break;
              case BOOL: {
                this.Bool(field.getName());
              }
              break;
              case BOOL_ARRAY: {
                this.BoolArray(field.getName(), field.bin.extra());
              }
              break;
              case BYTE: {
                this.Byte(field.getName());
              }
              break;
              case BYTE_ARRAY: {
                this.ByteArray(field.getName(), field.bin.extra());
              }
              break;
              case UBYTE: {
                this.UByte(field.getName());
              }
              break;
              case UBYTE_ARRAY: {
                this.UByteArray(field.getName(), field.bin.extra());
              }
              break;
              case SHORT: {
                this.Short(field.getName());
              }
              break;
              case SHORT_ARRAY: {
                this.ShortArray(field.getName(), field.bin.extra());
              }
              break;
              case USHORT: {
                this.UShort(field.getName());
              }
              break;
              case USHORT_ARRAY: {
                this.UShortArray(field.getName(), field.bin.extra());
              }
              break;
              case INT: {
                this.Int(field.getName());
              }
              break;
              case INT_ARRAY: {
                this.IntArray(field.getName(), field.bin.extra());
              }
              break;
              case LONG: {
                this.Long(field.getName());
              }
              break;
              case LONG_ARRAY: {
                this.LongArray(field.getName(), field.bin.extra());
              }
              break;
              case FLOAT: {
                this.Float(field.getName());
              }
              break;
              case FLOAT_ARRAY: {
                this.FloatArray(field.getName(), field.bin.extra());
              }
              break;
              case DOUBLE: {
                this.Double(field.getName());
              }
              break;
              case DOUBLE_ARRAY: {
                this.DoubleArray(field.getName(), field.bin.extra());
              }
              break;
              case STRING: {
                this.String(field.getName());
              }
              break;
              case STRING_ARRAY: {
                this.StringArray(field.getName(), field.bin.extra());
              }
              break;
              default:
                throw new Error("Unexpected type:" + type);
            }
          }
        }
        final String comment = field.getComment();
        if (comment.length() != 0) {
          this.Comment(comment);
        }
      }
    }

    this.byteOrder = old;

    return this;
  }

  protected JBBPDslBuilder addAnnotatedClass(final Class<?> annotatedClass, final boolean onlyFields) {
    final BinFieldContainer collected = collectAnnotatedFields(annotatedClass);

    final JBBPByteOrder old = this.byteOrder;
    this.byteOrder = JBBPByteOrder.BIG_ENDIAN;

    class Pair {
      final BinFieldContainer container;
      final Iterator<BinField> iter;

      Pair(final BinFieldContainer container) {
        this.container = container;
        this.iter = container.fields.iterator();
      }
    }

    if (onlyFields) {
      int indexOfLastEndStruct = -1;
      for (int i = collected.fields.size() - 1; i >= 0; i--) {
        if (collected.fields.get(i) == BinFieldContainer.END_STRUCT) {
          indexOfLastEndStruct = i;
          break;
        }
      }
      if (indexOfLastEndStruct >= 0) {
        collected.fields.remove(indexOfLastEndStruct);
      } else {
        throw new IllegalStateException("Can't find end of structure");
      }
    } else {
      this.Struct(collected.getName());
    }

    final List<Pair> stack = new ArrayList<Pair>();
    stack.add(new Pair(collected));

    while (!stack.isEmpty()) {
      final Pair pair = stack.remove(0);
      while (pair.iter.hasNext()) {
        final BinField field = pair.iter.next();
        if (field instanceof BinFieldContainer) {
          final BinFieldContainer conty = (BinFieldContainer) field;
          if (conty == BinFieldContainer.END_STRUCT) {
            this.CloseStruct();
          } else {
            if (field.isArrayField()) {
              this.StructArray(conty.getName(), conty.bin.extra());
            } else {
              this.Struct(conty.getName());
            }
            stack.add(0, pair);
            stack.add(0, new Pair(conty));
            break;
          }
        } else {
          if (field.isCustomBin()) {
            this.ByteOrder(pair.container.getByteOrder(field));
            if (field.isArrayField() || field.binCustom.arraySizeExpression().length() > 0) {
              this.CustomArray(field.binCustom.type(), field.getName(), field.binCustom.arraySizeExpression(), field.binCustom.extraExpression());
            } else {
              this.Custom(field.binCustom.type(), field.getName(), field.binCustom.extraExpression());
            }
          } else {
            final BinType type = field.findType();
            this.ByteOrder(pair.container.getByteOrder(field));
            switch (type) {
              case BIT_ARRAY: {
                this.BitArray(field.getName(), pair.container.getBitNumber(field), field.bin.extra());
              }
              break;
              case BIT: {
                this.Bits(field.getName(), pair.container.getBitNumber(field));
              }
              break;
              case BOOL: {
                this.Bool(field.getName());
              }
              break;
              case BOOL_ARRAY: {
                this.BoolArray(field.getName(), field.bin.extra());
              }
              break;
              case BYTE: {
                this.Byte(field.getName());
              }
              break;
              case BYTE_ARRAY: {
                this.ByteArray(field.getName(), field.bin.extra());
              }
              break;
              case UBYTE: {
                this.UByte(field.getName());
              }
              break;
              case UBYTE_ARRAY: {
                this.UByteArray(field.getName(), field.bin.extra());
              }
              break;
              case SHORT: {
                this.Short(field.getName());
              }
              break;
              case SHORT_ARRAY: {
                this.ShortArray(field.getName(), field.bin.extra());
              }
              break;
              case USHORT: {
                this.UShort(field.getName());
              }
              break;
              case USHORT_ARRAY: {
                this.UShortArray(field.getName(), field.bin.extra());
              }
              break;
              case INT: {
                this.Int(field.getName());
              }
              break;
              case INT_ARRAY: {
                this.IntArray(field.getName(), field.bin.extra());
              }
              break;
              case LONG: {
                this.Long(field.getName());
              }
              break;
              case LONG_ARRAY: {
                this.LongArray(field.getName(), field.bin.extra());
              }
              break;
              case FLOAT: {
                this.Float(field.getName());
              }
              break;
              case FLOAT_ARRAY: {
                this.FloatArray(field.getName(), field.bin.extra());
              }
              break;
              case DOUBLE: {
                this.Double(field.getName());
              }
              break;
              case DOUBLE_ARRAY: {
                this.DoubleArray(field.getName(), field.bin.extra());
              }
              break;
              case STRING: {
                this.String(field.getName());
              }
              break;
              case STRING_ARRAY: {
                this.StringArray(field.getName(), field.bin.extra());
              }
              break;
              default:
                throw new Error("Unexpected type:" + type);
            }
          }
        }
        final String comment = field.getComment();
        if (comment.length() != 0) {
          this.Comment(comment);
        }
      }
    }

    this.byteOrder = old;

    return this;
  }

Replace Generic With Diamond ArrayList<Pair> with ArrayList<> in method protected addAnnotatedClass(annotatedClass Class<?>, onlyFields boolean) : JBBPDslBuilder from class com.igormaznitsa.jbbp.utils.JBBPDslBuilder


  /**
   * Convert array of JBBP fields into a list.
   *
   * @param fields an array of fields, must not be null
   * @return a list of JBBP fields
   */
  public static List<JBBPAbstractField> fieldsAsList(final JBBPAbstractField... fields) {
    final List<JBBPAbstractField> result = new ArrayList<>();
    Collections.addAll(result, fields);
    return result;
  }

  /**
   * Convert array of JBBP fields into a list.
   *
   * @param fields an array of fields, must not be null
   * @return a list of JBBP fields
   */
  public static List<JBBPAbstractField> fieldsAsList(final JBBPAbstractField... fields) {
    final List<JBBPAbstractField> result = new ArrayList<JBBPAbstractField>();
    Collections.addAll(result, fields);
    return result;
  }

Replace Generic With Diamond ArrayList<JBBPAbstractField> with ArrayList<> in method public fieldsAsList(fields JBBPAbstractField...) : List<JBBPAbstractField> from class com.igormaznitsa.jbbp.utils.JBBPUtils


  @Test
  public void testConstructor_ProviderIsNotNull() {
    final JBBPExternalValueProvider provider = (fieldName, numericFieldMap, compiledBlock) -> 0;
    final JBBPNamedNumericFieldMap map = new JBBPNamedNumericFieldMap(provider);
    assertEquals(0, map.size());
    assertSame(provider, map.getExternalValueProvider());
  }

  @Test
  public void testConstructor_ProviderIsNotNull() {
    final JBBPExternalValueProvider provider = new JBBPExternalValueProvider() {

      @Override
      public int provideArraySize(String fieldName, JBBPNamedNumericFieldMap numericFieldMap, JBBPCompiledBlock compiledBlock) {
        return 0;
      }
    };
    final JBBPNamedNumericFieldMap map = new JBBPNamedNumericFieldMap(provider);
    assertEquals(0, map.size());
    assertSame(provider, map.getExternalValueProvider());
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPNamedNumericFieldMapTest.testConstructor_ProviderIsNotNull.provider.new JBBPExternalValueProvider with (fieldName, numericFieldMap, compiledBlock) -> 0 in method public testConstructor_ProviderIsNotNull() : void from class com.igormaznitsa.jbbp.JBBPNamedNumericFieldMapTest


  @Test
  public void testGetExternalValueProvider() {
    final JBBPExternalValueProvider provider = (fieldName, numericFieldMap, compiledBlock) -> 0;
    final JBBPNamedNumericFieldMap map = new JBBPNamedNumericFieldMap(provider);
    assertSame(provider, map.getExternalValueProvider());

    final JBBPNamedNumericFieldMap map2 = new JBBPNamedNumericFieldMap(null);
    try {
      map2.getExternalFieldValue("test", JBBPCompiledBlock.prepare().setSource("").setCompiledData(new byte[] {0}).build(), null);
      fail("Must throw JBBPEvalException");
    } catch (JBBPEvalException ex) {
    }
  }

  @Test
  public void testGetExternalValueProvider() {
    final JBBPExternalValueProvider provider = new JBBPExternalValueProvider() {

      @Override
      public int provideArraySize(String fieldName, JBBPNamedNumericFieldMap numericFieldMap, JBBPCompiledBlock compiledBlock) {
        return 0;
      }
    };
    final JBBPNamedNumericFieldMap map = new JBBPNamedNumericFieldMap(provider);
    assertSame(provider, map.getExternalValueProvider());

    final JBBPNamedNumericFieldMap map2 = new JBBPNamedNumericFieldMap(null);
    try {
      map2.getExternalFieldValue("test", JBBPCompiledBlock.prepare().setSource("").setCompiledData(new byte[] {0}).build(), null);
      fail("Must throw JBBPEvalException");
    } catch (JBBPEvalException ex) {
    }
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPNamedNumericFieldMapTest.testGetExternalValueProvider.provider.new JBBPExternalValueProvider with (fieldName, numericFieldMap, compiledBlock) -> 0 in method public testGetExternalValueProvider() : void from class com.igormaznitsa.jbbp.JBBPNamedNumericFieldMapTest


  @Test
  public void testFieldNameCaseInsensetive_ExceptionForDuplicationOfFieldNames() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPParser.prepare("bool Field1; byte field1;"));
  }

  @Test
  public void testFieldNameCaseInsensetive_ExceptionForDuplicationOfFieldNames() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("bool Field1; byte field1;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testFieldNameCaseInsensetive_ExceptionForDuplicationOfFieldNames.assertThrows.new Executable with () -> JBBPParser.prepare("bool Field1; byte field1;") in method public testFieldNameCaseInsensetive_ExceptionForDuplicationOfFieldNames() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Bool_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("bool;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Bool_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("bool;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Bool_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Bool_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Byte_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("byte;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Byte_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("byte;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Byte_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Byte_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_String_ErrorForEOF() {
    final JBBPParser parser = JBBPParser.prepare("stringj;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_String_ErrorForEOF() {
    final JBBPParser parser = JBBPParser.prepare("stringj;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_String_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_String_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_UByte_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("ubyte;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_UByte_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("ubyte;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_UByte_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_UByte_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Short_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Short_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Short_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Short_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_UShort_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("ushort;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_UShort_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("ushort;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_UShort_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_UShort_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Int_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("int;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Int_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("int;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Int_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Int_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Float_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("floatj;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Float_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("floatj;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Float_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Float_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Long_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("long;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Long_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("long;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Long_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Long_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Double_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("doublej;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[0]));
  }

  @Test
  public void testParse_Double_ErrorForEOF() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("doublej;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Double_ErrorForEOF.assertThrows.new Executable with () -> parser.parse(new byte[0]) in method public testParse_Double_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_StringFieldInArihmeticExpression_ArihmeticException() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("byte a; stringj b; byte[a+b];");
    assertThrows(ArithmeticException.class, () -> parser.parse(new byte[] {1, 3, 65, 66, 67, 0, 1, 2, 3}));
  }

  @Test
  public void testParse_StringFieldInArihmeticExpression_ArihmeticException() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("byte a; stringj b; byte[a+b];");
    assertThrows(ArithmeticException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[] {1, 3, 65, 66, 67, 0, 1, 2, 3});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_StringFieldInArihmeticExpression_ArihmeticException.assertThrows.new Executable with () -> parser.parse(new byte[]{1,3,65,66,67,0,1,2,3}) in method public testParse_StringFieldInArihmeticExpression_ArihmeticException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_StringFieldAsSingleVariableInExpression_ArihmeticException() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("stringj b; byte[b];");
    assertThrows(ArithmeticException.class, () -> parser.parse(new byte[] {3, 65, 66, 67, 0, 1, 2, 3}));
  }

  @Test
  public void testParse_StringFieldAsSingleVariableInExpression_ArihmeticException() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("stringj b; byte[b];");
    assertThrows(ArithmeticException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[] {3, 65, 66, 67, 0, 1, 2, 3});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_StringFieldAsSingleVariableInExpression_ArihmeticException.assertThrows.new Executable with () -> parser.parse(new byte[]{3,65,66,67,0,1,2,3}) in method public testParse_StringFieldAsSingleVariableInExpression_ArihmeticException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_SingleNonamedVar_ErrorForNullResult() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var; int;");
    assertThrows(NullPointerException.class, () -> {
      final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

        @Override
        public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          fail("Must not be called");
          return null;
        }

        @Override
        public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          return null;
        }
      }, null);
    });
  }

  @Test
  public void testParse_SingleNonamedVar_ErrorForNullResult() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var; int;");
    assertThrows(NullPointerException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

          @Override
          public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            fail("Must not be called");
            return null;
          }

          @Override
          public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            return null;
          }
        }, null);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_SingleNonamedVar_ErrorForNullResult.assertThrows.new Executable with () -> {final JBBPFieldStruct struct=parser.parse(new byte[]{9,8,33,1,2,3,4},new JBBPVarFieldProcessor(){ in method public testParse_SingleNonamedVar_ErrorForNullResult() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_SingleNonamedVar_ErrorForArrayResult() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var; int;");

    assertThrows(JBBPParsingException.class, () -> {
      final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

        @Override
        public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          fail("Must not be called");
          return null;
        }

        @Override
        public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          return new JBBPFieldArrayByte(fieldName, new byte[] {1, 2, 3});
        }
      }, null);
    });
  }

  @Test
  public void testParse_SingleNonamedVar_ErrorForArrayResult() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var; int;");

    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

          @Override
          public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            fail("Must not be called");
            return null;
          }

          @Override
          public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            return new JBBPFieldArrayByte(fieldName, new byte[] {1, 2, 3});
          }
        }, null);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_SingleNonamedVar_ErrorForArrayResult.assertThrows.new Executable with () -> {final JBBPFieldStruct struct=parser.parse(new byte[]{9,8,33,1,2,3,4},new JBBPVarFieldProcessor(){ in method public testParse_SingleNonamedVar_ErrorForArrayResult() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_SingleNonamedVar_ErrorForDifferentName() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var name; int;");

    assertThrows(JBBPParsingException.class, () -> {
      final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

        @Override
        public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          fail("Must not be called");
          return null;
        }

        @Override
        public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          assertNotNull(fieldName);
          return new JBBPFieldByte(new JBBPNamedFieldInfo("jskdjhsd", "dlkjsf", 0), (byte) 1);
        }
      }, null);
    });
  }

  @Test
  public void testParse_SingleNonamedVar_ErrorForDifferentName() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var name; int;");

    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

          @Override
          public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            fail("Must not be called");
            return null;
          }

          @Override
          public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            assertNotNull(fieldName);
            return new JBBPFieldByte(new JBBPNamedFieldInfo("jskdjhsd", "dlkjsf", 0), (byte) 1);
          }
        }, null);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_SingleNonamedVar_ErrorForDifferentName.assertThrows.new Executable with () -> {final JBBPFieldStruct struct=parser.parse(new byte[]{9,8,33,1,2,3,4},new JBBPVarFieldProcessor(){ in method public testParse_SingleNonamedVar_ErrorForDifferentName() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_SingleNonamedVarArray_ErrorForNullResult() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var [k]; int;");

    assertThrows(NullPointerException.class, () -> {
      final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

        @Override
        public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          assertEquals(0x0908, arraySize);
          return null;
        }

        @Override
        public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          fail("Must not be called");
          return null;
        }
      }, null);
    });
  }

  @Test
  public void testParse_SingleNonamedVarArray_ErrorForNullResult() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var [k]; int;");

    assertThrows(NullPointerException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

          @Override
          public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            assertEquals(0x0908, arraySize);
            return null;
          }

          @Override
          public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            fail("Must not be called");
            return null;
          }
        }, null);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_SingleNonamedVarArray_ErrorForNullResult.assertThrows.new Executable with () -> {final JBBPFieldStruct struct=parser.parse(new byte[]{9,8,33,1,2,3,4},new JBBPVarFieldProcessor(){ in method public testParse_SingleNonamedVarArray_ErrorForNullResult() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_SingleNonamedVarArray_ErrorForDifferentName() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var [234] name; int;");

    assertThrows(JBBPParsingException.class, () -> {
      final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

        @Override
        public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          assertNotNull(fieldName);
          return new JBBPFieldArrayByte(new JBBPNamedFieldInfo("jskdjhsd", "dlkjsf", 0), new byte[] {1});
        }

        @Override
        public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
          fail("Must not be called");
          return null;
        }
      }, null);
    });
  }

  @Test
  public void testParse_SingleNonamedVarArray_ErrorForDifferentName() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("short k; var [234] name; int;");

    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        final JBBPFieldStruct struct = parser.parse(new byte[] {9, 8, 33, 1, 2, 3, 4}, new JBBPVarFieldProcessor() {

          @Override
          public JBBPAbstractArrayField<? extends JBBPAbstractField> readVarArray(final JBBPBitInputStream inStream, final int arraySize, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            assertNotNull(fieldName);
            return new JBBPFieldArrayByte(new JBBPNamedFieldInfo("jskdjhsd", "dlkjsf", 0), new byte[] {1});
          }

          @Override
          public JBBPAbstractField readVarField(final JBBPBitInputStream inStream, final JBBPNamedFieldInfo fieldName, final int extraValue, final JBBPByteOrder byteOrder, final JBBPNamedNumericFieldMap numericFieldMap) throws IOException {
            fail("Must not be called");
            return null;
          }
        }, null);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_SingleNonamedVarArray_ErrorForDifferentName.assertThrows.new Executable with () -> {final JBBPFieldStruct struct=parser.parse(new byte[]{9,8,33,1,2,3,4},new JBBPVarFieldProcessor(){ in method public testParse_SingleNonamedVarArray_ErrorForDifferentName() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_BitFields_EOF() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("bit:4;").parse(new byte[0]));
  }

  @Test
  public void testParse_BitFields_EOF() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("bit:4;").parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_BitFields_EOF.assertThrows.new Executable with () -> JBBPParser.prepare("bit:4;").parse(new byte[0]) in method public testParse_BitFields_EOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_BitFieldArray_EOF() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("bit:4 [1];").parse(new byte[0]));
  }

  @Test
  public void testParse_BitFieldArray_EOF() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("bit:4 [1];").parse(new byte[0]);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_BitFieldArray_EOF.assertThrows.new Executable with () -> JBBPParser.prepare("bit:4 [1];").parse(new byte[0]) in method public testParse_BitFieldArray_EOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Align_ErrorForEOF() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; align:34;").parse(new byte[] {1}));
  }

  @Test
  public void testParse_Align_ErrorForEOF() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; align:34;").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Align_ErrorForEOF.assertThrows.new Executable with () -> JBBPParser.prepare("byte; align:34;").parse(new byte[]{1}) in method public testParse_Align_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Skip_Default_ErrorForEOF() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; skip;").parse(new byte[] {1}));
  }

  @Test
  public void testParse_Skip_Default_ErrorForEOF() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; skip;").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Skip_Default_ErrorForEOF.assertThrows.new Executable with () -> JBBPParser.prepare("byte; skip;").parse(new byte[]{1}) in method public testParse_Skip_Default_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Skip_ErrorForEOF() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; skip:34;").parse(new byte[] {1}));
  }

  @Test
  public void testParse_Skip_ErrorForEOF() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; skip:34;").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Skip_ErrorForEOF.assertThrows.new Executable with () -> JBBPParser.prepare("byte; skip:34;").parse(new byte[]{1}) in method public testParse_Skip_ErrorForEOF() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_Skip_TooLongDistance() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("byte; skip:33; short;");
    assertThrows(EOFException.class, () -> parser.parse(new byte[] {1, 2, 3, 4, 5, 6, 7, 8}));
  }

  @Test
  public void testParse_Skip_TooLongDistance() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("byte; skip:33; short;");
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(new byte[] {1, 2, 3, 4, 5, 6, 7, 8});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_Skip_TooLongDistance.assertThrows.new Executable with () -> parser.parse(new byte[]{1,2,3,4,5,6,7,8}) in method public testParse_Skip_TooLongDistance() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedBitArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; bit:4[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedBitArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; bit:4[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedBitArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; bit:4[1];").parse(new byte[]{1}) in method public testParse_FixedBitArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedByteArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; byte[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedByteArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; byte[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedByteArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; byte[1];").parse(new byte[]{1}) in method public testParse_FixedByteArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedUByteArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; ubyte[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedUByteArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; ubyte[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedUByteArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; ubyte[1];").parse(new byte[]{1}) in method public testParse_FixedUByteArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedBooleanArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; bool[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedBooleanArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; bool[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedBooleanArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; bool[1];").parse(new byte[]{1}) in method public testParse_FixedBooleanArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedShortArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; short[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedShortArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; short[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedShortArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; short[1];").parse(new byte[]{1}) in method public testParse_FixedShortArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedUShortArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; ushort[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedUShortArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; ushort[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedUShortArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; ushort[1];").parse(new byte[]{1}) in method public testParse_FixedUShortArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedIntArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; int[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedIntArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; int[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedIntArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; int[1];").parse(new byte[]{1}) in method public testParse_FixedIntArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedFloatArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; floatj[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedFloatArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; floatj[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedFloatArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; floatj[1];").parse(new byte[]{1}) in method public testParse_FixedFloatArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedLongArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; long[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedLongArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; long[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedLongArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; long[1];").parse(new byte[]{1}) in method public testParse_FixedLongArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_FixedDoubleArray_EOFException() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("byte; doublej[1];").parse(new byte[] {1}));
  }

  @Test
  public void testParse_FixedDoubleArray_EOFException() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("byte; doublej[1];").parse(new byte[] {1});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_FixedDoubleArray_EOFException.assertThrows.new Executable with () -> JBBPParser.prepare("byte; doublej[1];").parse(new byte[]{1}) in method public testParse_FixedDoubleArray_EOFException() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_NegativeCalculatedArrayLength() throws Exception {
    assertThrows(JBBPParsingException.class, () -> JBBPParser.prepare("ubyte len; byte[len-4];").parse(new byte[] {2, 1, 2, 3, 4}));
  }

  @Test
  public void testParse_NegativeCalculatedArrayLength() throws Exception {
    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("ubyte len; byte[len-4];").parse(new byte[] {2, 1, 2, 3, 4});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_NegativeCalculatedArrayLength.assertThrows.new Executable with () -> JBBPParser.prepare("ubyte len; byte[len-4];").parse(new byte[]{2,1,2,3,4}) in method public testParse_NegativeCalculatedArrayLength() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_NegativeArrayLength() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPParser.prepare("ubyte len; byte[-2];").parse(new byte[] {2, 1, 2, 3, 4}));
  }

  @Test
  public void testParse_NegativeArrayLength() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("ubyte len; byte[-2];").parse(new byte[] {2, 1, 2, 3, 4});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_NegativeArrayLength.assertThrows.new Executable with () -> JBBPParser.prepare("ubyte len; byte[-2];").parse(new byte[]{2,1,2,3,4}) in method public testParse_NegativeArrayLength() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_ErrorForLessDataThanExpected() throws Exception {
    assertThrows(EOFException.class, () -> JBBPParser.prepare("ubyte len; byte[5];").parse(new byte[] {2, 1, 2, 3, 4}));
  }

  @Test
  public void testParse_ErrorForLessDataThanExpected() throws Exception {
    assertThrows(EOFException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPParser.prepare("ubyte len; byte[5];").parse(new byte[] {2, 1, 2, 3, 4});
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_ErrorForLessDataThanExpected.assertThrows.new Executable with () -> JBBPParser.prepare("ubyte len; byte[5];").parse(new byte[]{2,1,2,3,4}) in method public testParse_ErrorForLessDataThanExpected() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_ErrorForNotAllReadFields() throws Exception {
    final JBBPBitInputStream stream = new JBBPBitInputStream(new ByteArrayInputStream(new byte[] {1, 2, 3, 4}));
    final JBBPParser parser = JBBPParser.prepare("int a; int b;");
    assertThrows(JBBPParsingException.class, () -> parser.parse(stream));
  }

  @Test
  public void testParse_ErrorForNotAllReadFields() throws Exception {
    final JBBPBitInputStream stream = new JBBPBitInputStream(new ByteArrayInputStream(new byte[] {1, 2, 3, 4}));
    final JBBPParser parser = JBBPParser.prepare("int a; int b;");
    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(stream);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_ErrorForNotAllReadFields.assertThrows.new Executable with () -> parser.parse(stream) in method public testParse_ErrorForNotAllReadFields() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_NegativeExpressonResult_OneFieldAsExpression_FlagOff() throws Exception {
    final JBBPBitInputStream stream = new JBBPBitInputStream(new ByteArrayInputStream(new byte[] {(byte) 0xEF, 1, 2, 3}));
    final JBBPParser parser = JBBPParser.prepare("byte len; byte [len] arr;");

    assertThrows(JBBPParsingException.class, () -> parser.parse(stream));
  }

  @Test
  public void testParse_NegativeExpressonResult_OneFieldAsExpression_FlagOff() throws Exception {
    final JBBPBitInputStream stream = new JBBPBitInputStream(new ByteArrayInputStream(new byte[] {(byte) 0xEF, 1, 2, 3}));
    final JBBPParser parser = JBBPParser.prepare("byte len; byte [len] arr;");

    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(stream);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_NegativeExpressonResult_OneFieldAsExpression_FlagOff.assertThrows.new Executable with () -> parser.parse(stream) in method public testParse_NegativeExpressonResult_OneFieldAsExpression_FlagOff() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testParse_NegativeExpressonResult_ExpressionWithNegativeResult_FlagOff() throws Exception {
    final JBBPBitInputStream stream = new JBBPBitInputStream(new ByteArrayInputStream(new byte[] {2, 1, 2, 3}));
    final JBBPParser parser = JBBPParser.prepare("byte len; byte [len - 8] arr;");

    assertThrows(JBBPParsingException.class, () -> parser.parse(stream));
  }

  @Test
  public void testParse_NegativeExpressonResult_ExpressionWithNegativeResult_FlagOff() throws Exception {
    final JBBPBitInputStream stream = new JBBPBitInputStream(new ByteArrayInputStream(new byte[] {2, 1, 2, 3}));
    final JBBPParser parser = JBBPParser.prepare("byte len; byte [len - 8] arr;");

    assertThrows(JBBPParsingException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        parser.parse(stream);
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.JBBPParserTest.testParse_NegativeExpressonResult_ExpressionWithNegativeResult_FlagOff.assertThrows.new Executable with () -> parser.parse(stream) in method public testParse_NegativeExpressonResult_ExpressionWithNegativeResult_FlagOff() : void from class com.igormaznitsa.jbbp.JBBPParserTest


  @Test
  public void testCompile_ErrorForNamedAlignField() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("align hello;"));
  }

  @Test
  public void testCompile_ErrorForNamedAlignField() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("align hello;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForNamedAlignField.assertThrows.new Executable with () -> JBBPCompiler.compile("align hello;") in method public testCompile_ErrorForNamedAlignField() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForArrayAlignField() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("align [445] hello;"));
  }

  @Test
  public void testCompile_ErrorForArrayAlignField() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("align [445] hello;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForArrayAlignField.assertThrows.new Executable with () -> JBBPCompiler.compile("align [445] hello;") in method public testCompile_ErrorForArrayAlignField() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForZeroAlignValue() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("align:0;"));
  }

  @Test
  public void testCompile_ErrorForZeroAlignValue() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("align:0;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForZeroAlignValue.assertThrows.new Executable with () -> JBBPCompiler.compile("align:0;") in method public testCompile_ErrorForZeroAlignValue() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForNegativeAlignValue() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("align:-1;"));
  }

  @Test
  public void testCompile_ErrorForNegativeAlignValue() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("align:-1;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForNegativeAlignValue.assertThrows.new Executable with () -> JBBPCompiler.compile("align:-1;") in method public testCompile_ErrorForNegativeAlignValue() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForNonNumericAlignValue() throws Exception {
    assertThrows(JBBPTokenizerException.class, () -> JBBPCompiler.compile("align:hhh;"));
  }

  @Test
  public void testCompile_ErrorForNonNumericAlignValue() throws Exception {
    assertThrows(JBBPTokenizerException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("align:hhh;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForNonNumericAlignValue.assertThrows.new Executable with () -> JBBPCompiler.compile("align:hhh;") in method public testCompile_ErrorForNonNumericAlignValue() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForNamedSkipField() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("skip hello;"));
  }

  @Test
  public void testCompile_ErrorForNamedSkipField() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("skip hello;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForNamedSkipField.assertThrows.new Executable with () -> JBBPCompiler.compile("skip hello;") in method public testCompile_ErrorForNamedSkipField() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForArraySkipField() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("skip [445] hello;"));
  }

  @Test
  public void testCompile_ErrorForArraySkipField() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("skip [445] hello;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForArraySkipField.assertThrows.new Executable with () -> JBBPCompiler.compile("skip [445] hello;") in method public testCompile_ErrorForArraySkipField() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForNegativeSkipValue() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("skip:-1;"));
  }

  @Test
  public void testCompile_ErrorForNegativeSkipValue() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("skip:-1;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForNegativeSkipValue.assertThrows.new Executable with () -> JBBPCompiler.compile("skip:-1;") in method public testCompile_ErrorForNegativeSkipValue() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForNonNumericSkipValue() throws Exception {
    assertThrows(JBBPTokenizerException.class, () -> JBBPCompiler.compile("skip:hhh;"));
  }

  @Test
  public void testCompile_ErrorForNonNumericSkipValue() throws Exception {
    assertThrows(JBBPTokenizerException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("skip:hhh;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForNonNumericSkipValue.assertThrows.new Executable with () -> JBBPCompiler.compile("skip:hhh;") in method public testCompile_ErrorForNonNumericSkipValue() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForArrayAsVarLength() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("out { int [4] len; some {byte [len] HeLLo;} }"));
  }

  @Test
  public void testCompile_ErrorForArrayAsVarLength() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("out { int [4] len; some {byte [len] HeLLo;} }");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForArrayAsVarLength.assertThrows.new Executable with () -> JBBPCompiler.compile("out { int [4] len; some {byte [len] HeLLo;} }") in method public testCompile_ErrorForArrayAsVarLength() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForFieldInStructArrayAsVarLength() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("struct [10] {int [4] len;} some {byte [struct.len] HeLLo;} "));
  }

  @Test
  public void testCompile_ErrorForFieldInStructArrayAsVarLength() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("struct [10] {int [4] len;} some {byte [struct.len] HeLLo;} ");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForFieldInStructArrayAsVarLength.assertThrows.new Executable with () -> JBBPCompiler.compile("struct [10] {int [4] len;} some {byte [struct.len] HeLLo;} ") in method public testCompile_ErrorForFieldInStructArrayAsVarLength() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForFieldInStructAsVarLength() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("struct [10] {int len;} some {byte [struct.len] HeLLo;} "));
  }

  @Test
  public void testCompile_ErrorForFieldInStructAsVarLength() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("struct [10] {int len;} some {byte [struct.len] HeLLo;} ");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForFieldInStructAsVarLength.assertThrows.new Executable with () -> JBBPCompiler.compile("struct [10] {int len;} some {byte [struct.len] HeLLo;} ") in method public testCompile_ErrorForFieldInStructAsVarLength() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForUnknownFieldAsArrayLength() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("some {byte [struct.len] HeLLo;} "));
  }

  @Test
  public void testCompile_ErrorForUnknownFieldAsArrayLength() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("some {byte [struct.len] HeLLo;} ");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForUnknownFieldAsArrayLength.assertThrows.new Executable with () -> JBBPCompiler.compile("some {byte [struct.len] HeLLo;} ") in method public testCompile_ErrorForUnknownFieldAsArrayLength() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_correctFieldName() throws Exception {
    JBBPCompiler.compile("int a;int _a;int a11;int a_f;int a_1;");
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("int 1a;"));
  }

  @Test
  public void testCompile_correctFieldName() throws Exception {
    JBBPCompiler.compile("int a;int _a;int a11;int a_f;int a_1;");
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("int 1a;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_correctFieldName.assertThrows.new Executable with () -> JBBPCompiler.compile("int 1a;") in method public testCompile_correctFieldName() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  @Test
  public void testCompile_ErrorForResetWithExtraValue() throws Exception {
    assertThrows(JBBPCompilationException.class, () -> JBBPCompiler.compile("reset$$:1;"));
  }

  @Test
  public void testCompile_ErrorForResetWithExtraValue() throws Exception {
    assertThrows(JBBPCompilationException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        JBBPCompiler.compile("reset$$:1;");
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.JBBPCompilerTest.testCompile_ErrorForResetWithExtraValue.assertThrows.new Executable with () -> JBBPCompiler.compile("reset$$:1;") in method public testCompile_ErrorForResetWithExtraValue() : void from class com.igormaznitsa.jbbp.compiler.JBBPCompilerTest


  private byte[] loadResource(final String name) throws Exception {
    try(final InputStream result = this.getClass().getClassLoader().getResourceAsStream("com/igormaznitsa/jbbp/it/" + name)){
      return IOUtils.toByteArray(result);
    }
  }

  private byte[] loadResource(final String name) throws Exception {
    final InputStream result = this.getClass().getClassLoader().getResourceAsStream("com/igormaznitsa/jbbp/it/" + name);
    try {
      if (result == null) {
        throw new NullPointerException("Can't find resource '" + name + '\'');
      }
      return IOUtils.toByteArray(result);
    } finally {
      IOUtils.closeQuietly(result);
    }
  }

Try With Resources try(final InputStream result=this.getClass().getClassLoader().getResourceAsStream("com/igormaznitsa/jbbp/it/" + name)) in method private loadResource(name String) : byte[] from class com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest


  @Test
  public void testReadWrite_ExtendsSuperClassAndUseItsFields() throws Exception {
    final JBBPParser parser = JBBPParser.prepare(
        "stringj str;"
            + "stringj [2] strarr;"
            + "floatj flt;"
            + "floatj [2] fltarr;"
            + "doublej dbl;"
            + "doublej [2] dblarr;"
            + "ubyte len;"
            + "ins [_] {"
            + "      byte [len] a;"
            + "      byte b;"
            + "      byte c;"
            + "      insins {"
            + "        byte a;"
            + "      }"
            + "}"
    );

    this.printGeneratedClassText = true;

    final Map<String,String> superclasses = new HashMap<>();
    superclasses.put("ins",TestSuperclass.Ins.class.getCanonicalName());
    superclasses.put("ins.insins",TestSuperclass.Ins.InsIns.class.getCanonicalName());

    final String thePackage = JBBPToJava6ConverterReadWriteTest.class.getPackage().getName();

    final String text = JBBPToJava6Converter.makeBuilder(parser)
        .setMainClassName(CLASS_NAME)
        .setMainClassPackage(thePackage)
        .disableGenerateFields()
        .setSuperClass(TestSuperclass.class.getCanonicalName())
        .setMapSubClassesSuperclasses(superclasses)
        .setAddGettersSetters(false)
        .doInternalClassesNonStatic()
        .build()
        .convert();

    final String fullClassName = thePackage + '.' + CLASS_NAME;
    final ClassLoader classLoader = saveAndCompile(new JavaClassContent(fullClassName, text));

    final Object instance = ReflectUtils.newInstance(classLoader.loadClass(fullClassName));
    assertTrue(instance instanceof TestSuperclass);

    final byte [] etalon = new byte[] {
        0,
        2, 49, 50, 1, 51,
        1, 2, 3, 4,
        5, 6, 7, 8, 9, 10, 11, 12,
        1, 2, 3, 4, 5, 6, 7, 8,
        9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
        2,
        1,2,
        3,4,5
    };

    callRead(instance, etalon);

    final TestSuperclass parsed = (TestSuperclass) instance;

    assertNull(null, parsed.str);
    assertArrayEquals(new String[] {"12", "3"}, parsed.strarr);
    assertEquals(2.3879393E-38f, parsed.flt);
    assertArrayEquals(new float[] {6.301941E-36f, 1.661634E-33f}, parsed.fltarr);
    assertEquals(8.20788039913184E-304d, parsed.dbl);
    assertArrayEquals(new double[] {4.0383818836028145E-265d, 1.9074368412237584E-226d}, parsed.dblarr);

    assertEquals(1, parsed.ins.length);
    assertArrayEquals(new byte[]{1,2}, parsed.ins[0].a);
    assertEquals(3, parsed.ins[0].b);
    assertEquals(4, parsed.ins[0].c);
    assertEquals(5, parsed.ins[0].insins.a);

    assertArrayEquals(etalon, callWrite(instance));
  }

  @Test
  public void testReadWrite_ExtendsSuperClassAndUseItsFields() throws Exception {
    final JBBPParser parser = JBBPParser.prepare(
        "stringj str;"
            + "stringj [2] strarr;"
            + "floatj flt;"
            + "floatj [2] fltarr;"
            + "doublej dbl;"
            + "doublej [2] dblarr;"
            + "ubyte len;"
            + "ins [_] {"
            + "      byte [len] a;"
            + "      byte b;"
            + "      byte c;"
            + "      insins {"
            + "        byte a;"
            + "      }"
            + "}"
    );

    this.printGeneratedClassText = true;

    final Map<String,String> superclasses = new HashMap<String, String>();
    superclasses.put("ins",TestSuperclass.Ins.class.getCanonicalName());
    superclasses.put("ins.insins",TestSuperclass.Ins.InsIns.class.getCanonicalName());

    final String thePackage = JBBPToJava6ConverterReadWriteTest.class.getPackage().getName();

    final String text = JBBPToJava6Converter.makeBuilder(parser)
        .setMainClassName(CLASS_NAME)
        .setMainClassPackage(thePackage)
        .disableGenerateFields()
        .setSuperClass(TestSuperclass.class.getCanonicalName())
        .setMapSubClassesSuperclasses(superclasses)
        .setAddGettersSetters(false)
        .doInternalClassesNonStatic()
        .build()
        .convert();

    final String fullClassName = thePackage + '.' + CLASS_NAME;
    final ClassLoader classLoader = saveAndCompile(new JavaClassContent(fullClassName, text));

    final Object instance = ReflectUtils.newInstance(classLoader.loadClass(fullClassName));
    assertTrue(instance instanceof TestSuperclass);

    final byte [] etalon = new byte[] {
        0,
        2, 49, 50, 1, 51,
        1, 2, 3, 4,
        5, 6, 7, 8, 9, 10, 11, 12,
        1, 2, 3, 4, 5, 6, 7, 8,
        9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
        2,
        1,2,
        3,4,5
    };

    callRead(instance, etalon);

    final TestSuperclass parsed = (TestSuperclass) instance;

    assertNull(null, parsed.str);
    assertArrayEquals(new String[] {"12", "3"}, parsed.strarr);
    assertEquals(2.3879393E-38f, parsed.flt);
    assertArrayEquals(new float[] {6.301941E-36f, 1.661634E-33f}, parsed.fltarr);
    assertEquals(8.20788039913184E-304d, parsed.dbl);
    assertArrayEquals(new double[] {4.0383818836028145E-265d, 1.9074368412237584E-226d}, parsed.dblarr);

    assertEquals(1, parsed.ins.length);
    assertArrayEquals(new byte[]{1,2}, parsed.ins[0].a);
    assertEquals(3, parsed.ins[0].b);
    assertEquals(4, parsed.ins[0].c);
    assertEquals(5, parsed.ins[0].insins.a);

    assertArrayEquals(etalon, callWrite(instance));
  }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testReadWrite_ExtendsSuperClassAndUseItsFields() : void from class com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest


  @Test
  public void testReaWrite_StructMappedToInterface_Array_GettersSettersOn() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("z { x { y [_] { byte a;}}}");
    final Map<String, String> interfaceMap = new HashMap<>();
    interfaceMap.put("z.x.y", ByteTestInterface.class.getCanonicalName());
    final String text = JBBPToJava6Converter.makeBuilder(parser).setMainClassName(CLASS_NAME).setMainClassPackage(PACKAGE_NAME).setAddGettersSetters(true).setMapSubClassesInterfaces(interfaceMap).build().convert();
    final String fullClassName = PACKAGE_NAME + '.' + CLASS_NAME;
    final ClassLoader classLoader = saveAndCompile(new JavaClassContent(fullClassName, text));

    final Object instance = ReflectUtils.newInstance(classLoader.loadClass(fullClassName));
    callRead(instance, new byte[] {0, 1, 2, 3, 4, 5});
    final ByteTestInterface[] data = getFieldThroughGetters(instance, "z.x.y", ByteTestInterface[].class);
    for (int i = 0; i < 6; i++) {
      assertEquals(i, data[i].getA());
    }

    assertArrayEquals(new byte[] {0, 1, 2, 3, 4, 5}, callWrite(instance));
  }

  @Test
  public void testReaWrite_StructMappedToInterface_Array_GettersSettersOn() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("z { x { y [_] { byte a;}}}");
    final Map<String, String> interfaceMap = new HashMap<String, String>();
    interfaceMap.put("z.x.y", ByteTestInterface.class.getCanonicalName());
    final String text = JBBPToJava6Converter.makeBuilder(parser).setMainClassName(CLASS_NAME).setMainClassPackage(PACKAGE_NAME).setAddGettersSetters(true).setMapSubClassesInterfaces(interfaceMap).build().convert();
    final String fullClassName = PACKAGE_NAME + '.' + CLASS_NAME;
    final ClassLoader classLoader = saveAndCompile(new JavaClassContent(fullClassName, text));

    final Object instance = ReflectUtils.newInstance(classLoader.loadClass(fullClassName));
    callRead(instance, new byte[] {0, 1, 2, 3, 4, 5});
    final ByteTestInterface[] data = getFieldThroughGetters(instance, "z.x.y", ByteTestInterface[].class);
    for (int i = 0; i < 6; i++) {
      assertEquals(i, data[i].getA());
    }

    assertArrayEquals(new byte[] {0, 1, 2, 3, 4, 5}, callWrite(instance));
  }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testReaWrite_StructMappedToInterface_Array_GettersSettersOn() : void from class com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest


  @Test
  public void testReaWrite_StructMappedToInterface_NotArray_GettersSettersOn() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("z { x { y { byte a;}}}");
    final Map<String, String> interfaceMap = new HashMap<>();
    interfaceMap.put("z.x.y", ByteTestInterface.class.getCanonicalName());
    final String text = JBBPToJava6Converter.makeBuilder(parser).setMainClassName(CLASS_NAME).setMainClassPackage(PACKAGE_NAME).setAddGettersSetters(true).setMapSubClassesInterfaces(interfaceMap).build().convert();
    final String fullClassName = PACKAGE_NAME + '.' + CLASS_NAME;
    final ClassLoader classLoader = saveAndCompile(new JavaClassContent(fullClassName, text));

    final Object instance = ReflectUtils.newInstance(classLoader.loadClass(fullClassName));
    callRead(instance, new byte[] {42});
    final ByteTestInterface data = getFieldThroughGetters(instance, "z.x.y", ByteTestInterface.class);
    assertEquals(42, data.getA());

    assertArrayEquals(new byte[] {42}, callWrite(instance));
  }

  @Test
  public void testReaWrite_StructMappedToInterface_NotArray_GettersSettersOn() throws Exception {
    final JBBPParser parser = JBBPParser.prepare("z { x { y { byte a;}}}");
    final Map<String, String> interfaceMap = new HashMap<String, String>();
    interfaceMap.put("z.x.y", ByteTestInterface.class.getCanonicalName());
    final String text = JBBPToJava6Converter.makeBuilder(parser).setMainClassName(CLASS_NAME).setMainClassPackage(PACKAGE_NAME).setAddGettersSetters(true).setMapSubClassesInterfaces(interfaceMap).build().convert();
    final String fullClassName = PACKAGE_NAME + '.' + CLASS_NAME;
    final ClassLoader classLoader = saveAndCompile(new JavaClassContent(fullClassName, text));

    final Object instance = ReflectUtils.newInstance(classLoader.loadClass(fullClassName));
    callRead(instance, new byte[] {42});
    final ByteTestInterface data = getFieldThroughGetters(instance, "z.x.y", ByteTestInterface.class);
    assertEquals(42, data.getA());

    assertArrayEquals(new byte[] {42}, callWrite(instance));
  }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testReaWrite_StructMappedToInterface_NotArray_GettersSettersOn() : void from class com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest


  @Test
  public void testRead_ExpressionResult_OnlyField_NegativeResultNotAllowed() throws Exception {
    final Object instance = compileAndMakeInstance("byte len; byte [len] arr;");
    final byte[] etalon = new byte[] {(byte) 0xFE, 1, 2, 3, 4};
    assertThrows(IllegalArgumentException.class, () -> callRead(instance, etalon.clone()));
  }

  @Test
  public void testRead_ExpressionResult_OnlyField_NegativeResultNotAllowed() throws Exception {
    final Object instance = compileAndMakeInstance("byte len; byte [len] arr;");
    final byte[] etalon = new byte[] {(byte) 0xFE, 1, 2, 3, 4};
    assertThrows(IllegalArgumentException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        callRead(instance, etalon.clone());
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest.testRead_ExpressionResult_OnlyField_NegativeResultNotAllowed.assertThrows.new Executable with () -> callRead(instance,etalon.clone()) in method public testRead_ExpressionResult_OnlyField_NegativeResultNotAllowed() : void from class com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest


  @Test
  public void testRead_ExpressionResult_NegativeExpression_NegativeResultNotAllowed() throws Exception {
    final Object instance = compileAndMakeInstance("byte len; byte [len-9] arr;");
    final byte[] etalon = new byte[] {8, 1, 2, 3, 4};
    assertThrows(IllegalArgumentException.class, () -> callRead(instance, etalon.clone()));
  }

  @Test
  public void testRead_ExpressionResult_NegativeExpression_NegativeResultNotAllowed() throws Exception {
    final Object instance = compileAndMakeInstance("byte len; byte [len-9] arr;");
    final byte[] etalon = new byte[] {8, 1, 2, 3, 4};
    assertThrows(IllegalArgumentException.class, new Executable() {
      @Override
      public void execute() throws Throwable {
        callRead(instance, etalon.clone());
      }
    });
  }

Replace Anonymous With Lambda com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest.testRead_ExpressionResult_NegativeExpression_NegativeResultNotAllowed.assertThrows.new Executable with () -> callRead(instance,etalon.clone()) in method public testRead_ExpressionResult_NegativeExpression_NegativeResultNotAllowed() : void from class com.igormaznitsa.jbbp.compiler.conversion.JBBPToJava6ConverterReadWriteTest