PixelCsvWriter implements CsvWriter { @Override public void writeCsv(Object... input) throws IOException { validate(input); extract(input); final StringBuilder stringBuilder = new StringBuilder(); targetType.writeCsv(stringBuilder.toString()); } PixelCsvWriter(WriteStrategy writer, OutputFormatStrategy targetFormat); @Override void writeCsv(Object... input); @Override boolean isValidInput(Object... input);  }
@Test @Ignore public void testWriteCsv() throws Exception { final StringBuilder actual = new StringBuilder(); final PixelCsvWriter csvWriter = new PixelCsvWriter(new WriteStrategy() { @Override public void writeCsv(String fullOutput) throws IOException { actual.append(fullOutput); } }, new CsvWriterBuilder.BeamOutputFormat()); final Product testProduct = new Product("testProduct", "someType", 10, 10); final PixelPos[] pixelPositions = new PixelPos[2]; pixelPositions[0] = new PixelPos(); pixelPositions[1] = new PixelPos(); csvWriter.writeCsv(testProduct, pixelPositions); final StringBuilder expected = new StringBuilder(); expected.append("featureId\tattr_1:string\tattr_2:float"); expected.append("\n"); expected.append("0\tval_1\t10.0"); expected.append("\n"); expected.append("1\tval_2\t20.0"); expected.append("\n"); assertEquals(expected.toString(), actual.toString()); }