@Test public void testCommentTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setComment("$"); String tableOptions = fileFormat.toTableOptions(); assertContains("comment => '$'", tableOptions); }
@Test public void testSingleQuoteTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setQuote("'"); String tableOptions = fileFormat.toTableOptions(); assertContains("quote => ''''", tableOptions); }
@Test public void testEscapeTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setEscape("\\"); String tableOptions = fileFormat.toTableOptions(); assertContains("\"escape\" => '\\", tableOptions); }
@Test public void testFieldDelimiterTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setFieldDelimiter("@"); String tableOptions = fileFormat.toTableOptions(); assertContains("fieldDelimiter => '@'", tableOptions); }
@Test public void testExtractHeaderTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setExtractHeader(true); String tableOptions = fileFormat.toTableOptions(); assertContains("extractHeader => true", tableOptions); }
@Test public void testLineDelimiterTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setLineDelimiter("\t"); String tableOptions = fileFormat.toTableOptions(); assertContains("lineDelimiter => '\t'", tableOptions); }
@Test public void testLineDelimiterTextFileWithSingleQuote() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setLineDelimiter("'a"); String tableOptions = fileFormat.toTableOptions(); assertContains("lineDelimiter => '''a'", tableOptions); }
@Test public void testQuoteTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setQuote("\""); String tableOptions = fileFormat.toTableOptions(); assertContains("quote => '\"'", tableOptions); }
@Test public void testsetSkipFirstLineTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setSkipFirstLine(true); String tableOptions = fileFormat.toTableOptions(); assertContains("skipFirstLine => true", tableOptions); }
@Test public void testAutoGenerateColumnNamesTextFile() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); fileFormat.setAutoGenerateColumnNames(false); String tableOptions = fileFormat.toTableOptions(); assertContains("autoGenerateColumnNames => false", tableOptions); }
@Test public void testDefaultTextFileFormatOptions() throws Exception { TextFileConfig fileFormat = new TextFileConfig(); String tableOptions = fileFormat.toTableOptions(); assertContains("type => 'text'", tableOptions); assertContains("fieldDelimiter => ','", tableOptions); assertContains("comment => '#'", tableOptions); assertContains("\"escape\" => '\"'", tableOptions); assertContains("quote => '\"'", tableOptions); assertContains("lineDelimiter => '\r\n'", tableOptions); assertContains("extractHeader => false", tableOptions); assertContains("skipFirstLine => false", tableOptions); assertContains("autoGenerateColumnNames => true", tableOptions); }