public void checkNoSpaceLeft()
    {
        if (spaceLeft() != 0)
        {
            throw new IllegalStateException(
                    "Did not write as much data as expected.");
        }
    }
Verifies that {@link #spaceLeft()} returns zero. It's common to create a byte array that is exactly big enough to
hold a message, then write to it with a {@code CodedOutput}. Calling {@code checkNoSpaceLeft()} after writing
verifies that the message was actually as big as expected, which can help catch bugs.
protostuff-core/src/test/java/io/protostuff/CodedOutput.java