public void markElementStart() throws IOException {
    if (finished) {
      throw new IOException("Stream has been finished. Can not add any more elements.");
    }
    count++;
  }
@Test
  public void testAddingElementWhenFinishedThrows() throws Exception {
    expectedException.expect(IOException.class);
    expectedException.expectMessage("Stream has been finished.");
    testValues(toBytes("a")).markElementStart();
  }