@Test
public void testStreamingIterator() {

    String file = TestData.getTemporaryTestFile();
    List<Value> values = Lists.newArrayList();
    int count = TestData.getScaleCount();
    for (int i = 0; i < count; ++i) {
        values.add(TestData.getValue());
    }
    ByteBuffer bytes = ByteableCollections.toByteBuffer(values);
    FileSystem.writeBytes(bytes, file);
    int bufferSize = TestData.getScaleCount();
    Iterator<ByteBuffer> it = ByteableCollections.streamingIterator(file,
            bufferSize);
    List<Value> newValues = Lists.newArrayList();
    while (it.hasNext()) {
        newValues.add(Value.fromByteBuffer(it.next()));
    }
    Assert.assertEquals(values, newValues);
}