Examples of CsvTestRecord3


Examples of com.adaptiweb.utils.csvbind.CsvReaderTest.CsvTestRecord3

            Assert.assertTrue("Output file must exist!", outFile.exists());
           
            outFile.delete();
            CsvWriter<CsvTestRecord3> w2 = new CsvWriter<CsvTestRecord3>(new FileWriter(outFile),
                CsvTestRecord3.class, CsvConstants.EXCEL_SEPARATOR, CsvConstants.EXCEL_QUOTECHAR);
            CsvTestRecord3 tr = new CsvTestRecord3("field content;; with \"semicolons\"\"; and quotes", 1234567890, "f3", testDate, TestEnum.CCC, Arrays.asList("i1", "i2", "i3", "i4"));
            String out2 = w2.writeNext(tr);
            assertEquals("\"field content;; with \"\"semicolons\"\"\"\"; and quotes\";\"1234567890\";\"f3\";\"" + testDateFormat.format(testDate) + "\";\"" + TestEnum.CCC.name() + "\";\"i1\";\"i2\";\"i3\";\"i4\"\n", out2);
            Assert.assertTrue("Output file must exist!", outFile.exists());
           
            w2.closeResources();
View Full Code Here

Examples of com.adaptiweb.utils.csvbind.CsvReaderTest.CsvTestRecord3

        }
    }
 
  @Test
  public void testWriteToString() {
        CsvTestRecord3 tr1 = new CsvTestRecord3("field content;; with \"semicolons\"\"; and quotes1", 1234567891, "f4", testDate, TestEnum.AAA, Arrays.asList("i1", "i2", "i3", "i4"));
        CsvTestRecord3 tr2 = new CsvTestRecord3("field content;; with \"semicolons\"\"; and quotes2", 1234567892, "f5", testDate, TestEnum.BBB, Arrays.asList("j1", "j2", "j3"));
        String[] out = CsvWriter.writeToString(tr1, tr2).split("\n");
        assertEquals("\"field content;; with \"\"semicolons\"\"\"\"; and quotes1\";\"1234567891\";\"f4\";\"" + testDateFormat.format(testDate) + "\";\"" + TestEnum.AAA.name() + "\";\"i1\";\"i2\";\"i3\";\"i4\"", out[0]);
        assertEquals("\"field content;; with \"\"semicolons\"\"\"\"; and quotes2\";\"1234567892\";\"f5\";\"" + testDateFormat.format(testDate) + "\";\"" + TestEnum.BBB.name() + "\";\"j1\";\"j2\";\"j3\"", out[1]);
        assertEquals(2, out.length);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.