class VertexListStreamWriter implements AutoCloseable {

	public void writeAll() throws IOException {
		while (inputStream.hasNextVertex()) {
			writeNextVertex();
		}
		outputWriter.flush();
	}

}

class VertexListStreamWriterTest {

	private static final VertexListStream.VertexData[] vertices;
	private static final String expectedOutput;

	@Test
	public void testWriteAllOnMockVertexListStream() throws IOException {

		VertexListStream vertexListStream = new MockVertexListStream(vertices);
		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

		try (VertexListStreamWriter writer = new VertexListStreamWriter(vertexListStream, outputStream)) {
			writer.writeAll();
			assertEquals("Output of VertexListStreamWriter is correct", expectedOutput, outputStream.toString());
		}
	}

}