@Test(expected = IOException.class)
public void readBuffer_inputStreamLongerThanExpectedLength_shouldFail() throws IOException {

    final InputStream inputStream = createInputStream(TEST_BUFFER, 2);
    byte[] buffer = new byte[10];
    while (inputStream.read(buffer) != -1) {}
}