### Question:
WriteCsv { public static SampleWriter asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices) { return new SampleWriter(samples, 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 writeSamplesToCsv() throws IOException { File file = WriteCsv.asSamples(samples, 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", "5.0", "4.0", "3.0", "2.0"))); assertTrue(lines.get(1).equals( Arrays.asList("2.0", "4.0", "6.0", "8.0", "10.0", "10.0", "8.0", "6.0", "4.0"))); file.delete(); }
@Test public void writeSamplesToCsvWithHeader() throws IOException { File file = WriteCsv.asSamples(samples, rowTensors).withDefaultHeader().toFile(File.createTempFile("test", ".csv")); CsvReader reader = ReadCsv.fromFile(file).expectHeader(true); List<List<String>> lines = reader.readLines(); VertexId firstId = rowTensors.get(0).getId(); VertexId secondId = rowTensors.get(1).getId(); assertTrue(lines.size() == 2); assertTrue(reader.getHeader().equals(Arrays.asList( "{" + firstId + "}" + "[0]", "{" + firstId + "}" + "[1]", "{" + firstId + "}" + "[2]", "{" + firstId + "}" + "[3]", "{" + firstId + "}" + "[4]", "{" + secondId + "}" + "[0]", "{" + secondId + "}" + "[1]", "{" + secondId + "}" + "[2]", "{" + secondId + "}" + "[3]")) ); assertTrue(lines.get(0).equals( Arrays.asList("1.0", "2.0", "3.0", "4.0", "5.0", "5.0", "4.0", "3.0", "2.0"))); assertTrue(lines.get(1).equals( Arrays.asList("2.0", "4.0", "6.0", "8.0", "10.0", "10.0", "8.0", "6.0", "4.0"))); file.delete(); }