FixedLengthByteArrayIndexedList implements ByteArrayIndexedList { @Override public void writeTo( @NotNull final OutputStream os) throws IOException { os.write(Ints.toByteArray(elementSize)); os.write(Ints.toByteArray(elements.size())); for (OutputStreamWritable e : elements) { assert e.getSizeInBytes() == elementSize : "Wrong size"; e.writeTo(os); } } FixedLengthByteArrayIndexedList(
            @NotNull
            final Collection<UnsignedByteArray> elements); @Override long getSizeInBytes(); @Override void writeTo(
            @NotNull
            final OutputStream os); @Override String toString();  }
@Test(expected = AssertionError.class) public void expectFixed() throws IOException { new FixedLengthByteArrayIndexedList(asList(from(1), from(1L))) .writeTo(new ByteArrayOutputStream()); }