use of org.apache.calcite.util.Source in project calcite by apache.
the class FileReaderTest method testFileReaderDataNoTh.
/**
* Tests {@link FileReader} with no headings static file - data.
*/
@Test
public void testFileReaderDataNoTh() throws FileReaderException {
final Source source = Sources.file(null, file("target/test-classes/tableNoTH.html"));
FileReader t = new FileReader(source);
Iterator<Elements> i = t.iterator();
Elements row = i.next();
assertTrue(row.get(2).text().equals("R0C2"));
}
use of org.apache.calcite.util.Source in project calcite by apache.
the class FileReaderTest method testFileReaderData.
/**
* Test {@link FileReader} with static file - data.
*/
@Test
public void testFileReaderData() throws FileReaderException {
final Source source = Sources.file(null, file("target/test-classes/tableOK.html"));
FileReader t = new FileReader(source);
Iterator<Elements> i = t.iterator();
Elements row = i.next();
assertTrue(row.get(2).text().equals("R0C2"));
row = i.next();
assertTrue(row.get(0).text().equals("R1C0"));
}
use of org.apache.calcite.util.Source in project calcite by apache.
the class FileReaderTest method testFileReaderHeadingsBadFile.
/**
* Tests {@link FileReader} with bad static file - headings.
*/
@Test
public void testFileReaderHeadingsBadFile() throws FileReaderException {
final Source source = Sources.file(null, file("target/test-classes/tableNoTheadTbody.html"));
FileReader t = new FileReader(source);
Elements headings = t.getHeadings();
assertTrue(headings.get(1).text().equals("H1"));
}
use of org.apache.calcite.util.Source in project calcite by apache.
the class FileReaderTest method testFileReaderIterator.
/**
* Tests {@link FileReader} iterator with static file,
*/
@Test
public void testFileReaderIterator() throws FileReaderException {
final Source source = Sources.file(null, file("target/test-classes/tableOK.html"));
FileReader t = new FileReader(source);
Elements row = null;
for (Elements aT : t) {
row = aT;
}
assertFalse(row == null);
assertTrue(row.get(1).text().equals("R2C1"));
}
Aggregations