JBBPDslBuilder { public JBBPDslBuilder Val(final String name, final String expression) { final Item item = new ItemVal( assertTextNotNullAndTrimmedNotEmpty(name), assertExpressionChars(assertTextNotNullAndTrimmedNotEmpty(expression)).trim() ); this.addItem(item); return this; } protected  JBBPDslBuilder(); static JBBPDslBuilder Begin(); int size(); JBBPDslBuilder Align(); JBBPDslBuilder Align(final int alignBytes); JBBPDslBuilder Align(final String sizeExpression); JBBPDslBuilder Skip(); JBBPDslBuilder Skip(final int bytesToSkip); JBBPDslBuilder Skip(final String sizeExpression); JBBPDslBuilder Custom(final String type); JBBPDslBuilder Var(); JBBPDslBuilder Var(final String name); JBBPDslBuilder Var(final String name, final String param); JBBPDslBuilder Custom(final String type, final String name); JBBPDslBuilder Custom(final String type, final String name, final String param); JBBPDslBuilder Struct(); JBBPDslBuilder Struct(final String name); JBBPDslBuilder StructArray(final String sizeExpression); JBBPDslBuilder StructArray(final int size); JBBPDslBuilder StructArray(final String name, final int size); JBBPDslBuilder StructArray(final String name, final String sizeExpression); JBBPDslBuilder Val(final String name, final String expression); JBBPDslBuilder ResetCounter(); JBBPDslBuilder VarArray(final int size); JBBPDslBuilder VarArray(final String sizeExpression); JBBPDslBuilder VarArray(final String name, final int size); JBBPDslBuilder VarArray(final String name, final String sizeExpression); JBBPDslBuilder VarArray(final String name, final int size, final String param); JBBPDslBuilder VarArray(final String name, final String sizeExpression, final String param); JBBPDslBuilder CustomArray(final String type, final int size); JBBPDslBuilder CustomArray(final String type, final String size); JBBPDslBuilder CustomArray(final String type, final String name, final String size); JBBPDslBuilder CustomArray(final String type, final String name, final int size); JBBPDslBuilder CustomArray(final String type, final String name, final int size, final String param); JBBPDslBuilder CustomArray(final String type, final String name, final String sizeExpression, final String param); JBBPDslBuilder CloseStruct(); JBBPDslBuilder CloseStruct(final boolean closeAllOpened); boolean hasOpenedStructs(); JBBPDslBuilder Bit(); JBBPDslBuilder Bit(final String name); JBBPDslBuilder Bits(final int bits); JBBPDslBuilder Bits(final JBBPBitNumber bits); JBBPDslBuilder Bits(final String name, final JBBPBitNumber bits); JBBPDslBuilder Bits(final String name, final String bitLenExpression); JBBPDslBuilder BitArray(final JBBPBitNumber bits, final int size); JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final int size); JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final int size); JBBPDslBuilder BitArray(final JBBPBitNumber bits, final String sizeExpression); JBBPDslBuilder BitArray(final String bitLenExpression, final String sizeExpression); JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final String sizeExpression); JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final String sizeExpression); JBBPDslBuilder BoolArray(final String sizeExpression); JBBPDslBuilder BoolArray(final String name, final int size); JBBPDslBuilder BoolArray(final int size); JBBPDslBuilder BoolArray(final String name, final String sizeExpression); JBBPDslBuilder Bool(); JBBPDslBuilder Bool(final String name); JBBPDslBuilder Byte(); JBBPDslBuilder Byte(final String name); JBBPDslBuilder ByteArray(final String sizeExpression); JBBPDslBuilder ByteArray(final int size); JBBPDslBuilder ByteArray(final String name, final int size); JBBPDslBuilder ByteArray(final String name, final String sizeExpression); JBBPDslBuilder UByte(); JBBPDslBuilder UByte(final String name); JBBPDslBuilder UByteArray(final String sizeExpression); JBBPDslBuilder UByteArray(final int size); JBBPDslBuilder UByteArray(final String name, final int size); JBBPDslBuilder UByteArray(final String name, final String sizeExpression); JBBPDslBuilder Short(); JBBPDslBuilder Short(final String name); JBBPDslBuilder ShortArray(final String sizeExpression); JBBPDslBuilder ShortArray(final int size); JBBPDslBuilder ShortArray(final String name, final int size); JBBPDslBuilder ShortArray(final String name, final String sizeExpression); JBBPDslBuilder UShort(); JBBPDslBuilder UShort(final String name); JBBPDslBuilder UShortArray(final String sizeExpression); JBBPDslBuilder UShortArray(final int size); JBBPDslBuilder UShortArray(final String name, final String sizeExpression); JBBPDslBuilder UShortArray(final String name, final int size); JBBPDslBuilder Int(); JBBPDslBuilder Int(final String name); JBBPDslBuilder IntArray(final String sizeExpression); JBBPDslBuilder IntArray(final int size); JBBPDslBuilder IntArray(final String name, final int size); JBBPDslBuilder IntArray(final String name, final String sizeExpression); JBBPDslBuilder Long(); JBBPDslBuilder Long(final String name); JBBPDslBuilder LongArray(final String sizeExpression); JBBPDslBuilder LongArray(final int size); JBBPDslBuilder LongArray(final String name, final int size); JBBPDslBuilder LongArray(final String name, final String sizeExpression); JBBPDslBuilder Float(); JBBPDslBuilder Float(final String name); JBBPDslBuilder FloatArray(final String sizeExpression); JBBPDslBuilder FloatArray(final int size); JBBPDslBuilder FloatArray(final String name, final int size); JBBPDslBuilder FloatArray(final String name, final String sizeExpression); JBBPDslBuilder Double(); JBBPDslBuilder Double(final String name); JBBPDslBuilder Comment(final String text); JBBPDslBuilder NewLineComment(final String text); JBBPDslBuilder DoubleArray(final String sizeExpression); JBBPDslBuilder DoubleArray(final int size); JBBPDslBuilder DoubleArray(final String name, final int size); JBBPDslBuilder DoubleArray(final String name, final String sizeExpression); JBBPDslBuilder String(); JBBPDslBuilder String(final String name); JBBPDslBuilder StringArray(final String sizeExpression); JBBPDslBuilder StringArray(final int size); JBBPDslBuilder StringArray(final String name, final int size); JBBPDslBuilder StringArray(final String name, final String sizeExpression); JBBPDslBuilder ByteOrder(final JBBPByteOrder order); String End(); String End(final boolean format); JBBPDslBuilder AnnotatedClass(final Class<?> annotatedClass); JBBPDslBuilder AnnotatedClassFields(final Class<?> annotatedClass);  }
@Test public void testVal() { assertThrows(NullPointerException.class, () -> Begin().Val(null, "a+b").End()); assertThrows(NullPointerException.class, () -> Begin().Val("hello", null).End()); assertThrows(IllegalArgumentException.class, () -> Begin().Val("", "a+b").End()); assertThrows(IllegalArgumentException.class, () -> Begin().Val("hello", "").End()); assertEquals("val:(a+b) hello;", Begin().Val("hello", "a+b").End()); }