DatagramReader { public int bitsLeft() { return (byteStream.available() * Byte.SIZE) + (currentBitIndex + 1); } DatagramReader(final byte[] byteArray);  DatagramReader(final byte[] byteArray, boolean copy);  DatagramReader(final byte[] byteArray, int offset, int length);  DatagramReader(final ByteArrayInputStream byteStream); void mark(); void reset(); void close(); long readLong(final int numBits); int read(final int numBits); byte[] readBytes(final int count); byte readNextByte(); byte[] readBytesLeft(); boolean bytesAvailable(); boolean bytesAvailable(final int expectedBytes); int bitsLeft(); DatagramReader createRangeReader(int count); ByteArrayInputStream createRangeInputStream(int count);  }
@Test public void testBitsLeftWorksForEmptyBuffer() { givenABuffer(Bytes.EMPTY); assertThat(reader.bitsLeft(), is(0)); }