+ <target name="prepare_properties" depends="clean" description="reads properties and sets default values">
+ <!-- update build information by incrementing build-number and actualizing date -->
+ <propertyfile file="${basedir}/build.properties" comment="MCSUtils interactive build information file. This file is created automatically. DO NOT CHANGE !">
+ // thrown if Dispose was called without other methods
+ // being called. this should not throw an
+ // exception
+ String fileName = "somefile.csv";
+
+ new File(fileName).createNewFile();
+
+ try {
+ CsvReader reader = new CsvReader(fileName);
+ reader.close();
+ } finally {
+ new File(fileName).delete();
+ }
+ }
+
+ @Test
+ public void test34() throws Exception {
+ String data = "\"Chicane\", \"Love on the Run\", \"Knight Rider\", \"This field contains a comma, but it doesn't matter as the field is quoted\"\r\n"
+ + "\"Samuel Barber\", \"Adagio for Strings\", \"Classical\", \"This field contains a double quote character, \"\", but it doesn't matter as it is escaped\"";
+
+ CsvReader reader = CsvReader.parse(data);
+ Assert.assertTrue(reader.readRecord());
+ Assert.assertEquals("Chicane", reader.get(0));
+ Assert.assertEquals("Love on the Run", reader.get(1));
+ "\"Samuel Barber\", \"Adagio for Strings\", \"Classical\", \"This field contains a double quote character, \"\", but it doesn't matter as it is escaped\"",
+ reader.getRawRecord());
+ Assert.assertFalse(reader.readRecord());
+ reader.close();
+ }
+
+ @Test
+ public void test35() throws Exception {
+ String data = "Chicane, Love on the Run, Knight Rider, \"This field contains a comma, but it doesn't matter as the field is quoted\"";
+
+ CsvReader reader = CsvReader.parse(data);
+ Assert.assertTrue(reader.readRecord());
+ Assert.assertEquals("Chicane", reader.get(0));
+ Assert.assertEquals("Love on the Run", reader.get(1));
+ String data = " \" Chicane\" junk here , Love on the Run, Knight Rider, \"This field contains a comma, but it doesn't matter as the field is quoted\"";
+
+ CsvReader reader = CsvReader.parse(data);
+ Assert.assertTrue(reader.readRecord());
+ Assert.assertEquals(" Chicane", reader.get(0));
+ Assert.assertEquals("Love on the Run", reader.get(1));
+ String data = "\"Chicane\", \"Love on the Run\", \"Knight Rider\", \"This field contains a comma, but it doesn't matter as the field is quoted\"i"
+ + "\"Samuel Barber\", \"Adagio for Strings\", \"Classical\", \"This field contains a double quote character, \"\", but it doesn't matter as it is escaped\"";
+ "\"Samuel Barber\", \"Adagio for Strings\", \"Classical\", \"This field contains a double quote character, \"\", but it doesn't matter as it is escaped\"",
+ "Maximum column length of 100,000 exceeded in column 0 in record 0. Set the SafetySwitch property to false if you're expecting column lengths greater than 100,000 characters to avoid this error."),
+ ex);
+ }
+ reader.close();
+ }
+
+ @Test
+ public void test82() throws Exception {
+ StringBuilder holder = new StringBuilder(200010);
+ "Maximum column count of 100,000 exceeded in record 0. Set the SafetySwitch property to false if you're expecting more than 100,000 columns per record to avoid this error."),
+ "Maximum column length of 100,000 exceeded in column 0 in record 0. Set the SafetySwitch property to false if you're expecting column lengths greater than 100,000 characters to avoid this error."),