### Question:
WriteCsv { public static RowWriter asRows(List<? extends Vertex<? extends Tensor, ?>> vertices) { return new RowWriter(vertices); }  static SampleWriter asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices); static SampleWriter asSamples(NetworkSamples samples, Vertex<? extends Tensor, ?>... vertices); static RowWriter asRows(List<? extends Vertex<? extends Tensor, ?>> vertices); static ColumnWriter asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices); static ColumnWriter asColumns(Vertex<? extends Tensor, ?>... vertices); static int findLongestTensor(List<? extends Vertex<? extends Tensor, ?>> tensors);  }### Answer:
@Test public void writeRowOfTensorsToCsv() throws IOException { File file = WriteCsv.asRows(rowTensors).toFile(File.createTempFile("test", ".csv")); CsvReader reader = ReadCsv.fromFile(file).expectHeader(false); List<List<String>> lines = reader.readLines(); assertTrue(lines.size() == 2); assertTrue(lines.get(0).equals(Arrays.asList("1.0", "2.0", "3.0", "4.0", "5.0"))); assertTrue(lines.get(1).equals(Arrays.asList("5.0", "4.0", "3.0", "2.0", "-"))); file.delete(); }
@Test public void writeRowOfTensorsToCsvWithCustomEmptyValue() throws IOException { File file = WriteCsv.asRows(rowTensors).withEmptyValue("/").toFile(File.createTempFile("test", ".csv")); CsvReader reader = ReadCsv.fromFile(file).expectHeader(false); List<List<String>> lines = reader.readLines(); assertTrue(lines.size() == 2); assertTrue(lines.get(0).equals(Arrays.asList("1.0", "2.0", "3.0", "4.0", "5.0"))); assertTrue(lines.get(1).equals(Arrays.asList("5.0", "4.0", "3.0", "2.0", "/"))); file.delete(); }
@Test public void writeRowOfTensorsToCsvWithHeader() throws IOException { File file = WriteCsv.asRows(rowTensors).withDefaultHeader().toFile(File.createTempFile("test", ".csv")); CsvReader reader = ReadCsv.fromFile(file).expectHeader(true); List<List<String>> lines = reader.readLines(); assertTrue(lines.size() == 2); assertTrue(reader.getHeader().equals(Arrays.asList("[0]", "[1]", "[2]", "[3]", "[4]"))); assertTrue(lines.get(0).equals(Arrays.asList("1.0", "2.0", "3.0", "4.0", "5.0"))); assertTrue(lines.get(1).equals(Arrays.asList("5.0", "4.0", "3.0", "2.0", "-"))); file.delete(); }