@Test public void shouldMarshalWithPadding() throws Exception { PaddedInner inner = new PaddedInner(); inner.setA(12); inner.setB(34); PaddedOuter outer = new PaddedOuter(); outer.setInner(inner); outer.setC(56); Marshaller marshaller = dadlContext.createMarshaller(); ByteArrayOutputStream os = new ByteArrayOutputStream(); marshaller.marshal(outer, os); assertThat(os.toByteArray().length, is(11)); ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(os.toByteArray()); assertThat(reader.readShort(), is((short) 12)); assertThat(reader.readShort(), is((short) 34)); reader.skipBytes(5); assertThat(reader.readShort(), is((short) 56)); reader.close(); }