public static void readDataAndAssert(DataStoreReader<String> reader, String[] expected) throws IOException { String line = null; int count = 0; while ((line = reader.read()) != null) { assertThat(count, lessThan(expected.length)); assertThat(line, is(expected[count++])); } assertThat(count, is(expected.length)); line = reader.read(); assertNull("Expected null, got '" + line + "'", line); }
public static List<String> readData(DataStoreReader<String> reader) throws IOException { ArrayList<String> ret = new ArrayList<String>(); String line = null; while ((line = reader.read()) != null) { ret.add(line); } return ret; }