@Test public void testFromVoCsv() throws IOException { // String expectedJson = ReadData.readDataTextAsResource(TestUtils.DATA_DIR + // "transform/transformed_into_json.json"); TransformHandlerType type = TransformHandlerType.CSV; long resultsOffset = 0; long pageSize = -1; // no limits boolean allStrings = true; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream out = new PrintStream(baos); File tmpDir = new File("./transform_tmpdir"); tmpDir.mkdirs(); tmpDir.deleteOnExit(); TransformHandler handler = TransformHandlerFactory.createHandler( type, out, resultsOffset, pageSize, tmpDir, allStrings); // InputStream is = this.getClass().getResourceAsStream(TestUtils.DATA_DIR + // "transform/result.csv"); InputStream is = ReadData.findResource(this.getClass(), TestUtils.DATA_DIR + "transform/result.csv"); handler.parse(is); is.close(); out.close(); String output = new String(baos.toByteArray(), "UTF-8"); // System.out.println(output); Assert.assertEquals(expectedJson, output); }
@BeforeClass public static void oneTimeSetup() throws IOException { // expectedJson = ReadData.readDataTextAsResource(TestUtils.DATA_DIR + // "transform/transformed_into_json.json"); expectedJson = ReadData.readDataTextAsResource( TransformToJsonTest.class, TestUtils.DATA_DIR + "transform/transformed_into_json.json"); }