use of org.molgenis.emx2.io.tablestore.TableStoreForCsvFile in project molgenis-emx2 by molgenis.
the class TestColumnTypeIsFile method testCsvShouldNotIncludeFileColumns.
@Test
public void testCsvShouldNotIncludeFileColumns() throws IOException {
Path tmp = Files.createTempDirectory(null);
Path csvFile = tmp.resolve("User.csv");
MolgenisIO.toExcelFile(csvFile, schema.getTable("User"));
TableStore store = new TableStoreForCsvFile(csvFile);
assertFalse(store.readTable("User").iterator().next().getColumnNames().contains("picture"));
}
use of org.molgenis.emx2.io.tablestore.TableStoreForCsvFile in project molgenis-emx2 by molgenis.
the class TestTypesImport method testTsvTypeCast.
@Test
public void testTsvTypeCast() {
ClassLoader classLoader = getClass().getClassLoader();
Path path = new File(classLoader.getResource("TypeTest.tsv").getFile()).toPath();
TableStore store = new TableStoreForCsvFile(path);
for (Row r : store.readTable("Sheet1")) {
assertEquals("1", r.getString("column1"));
assertEquals("2", r.getString("column2"));
}
}
use of org.molgenis.emx2.io.tablestore.TableStoreForCsvFile in project molgenis-emx2 by molgenis.
the class TestTypesImport method testSemiColonTypeCast.
@Test
public void testSemiColonTypeCast() {
ClassLoader classLoader = getClass().getClassLoader();
Path path = new File(classLoader.getResource("TypeTestSemiColon.csv").getFile()).toPath();
TableStore store = new TableStoreForCsvFile(path);
for (Row r : store.readTable("Sheet1")) {
assertEquals("a", r.getString("string"));
assertEquals("b", r.getStringArray("string_array")[1]);
assertEquals("a,b", r.getStringArray("string_array2")[0]);
}
}
use of org.molgenis.emx2.io.tablestore.TableStoreForCsvFile in project molgenis-emx2 by molgenis.
the class TestTypesImport method testCsvTypesCast.
@Test
public void testCsvTypesCast() {
ClassLoader classLoader = getClass().getClassLoader();
Path path = new File(classLoader.getResource("TypeTest.csv").getFile()).toPath();
TableStore store = new TableStoreForCsvFile(path);
for (Row r : store.readTable("Sheet1")) {
assertEquals("Respiratory, allergy and skin characteristics", r.getStringArray("string_array")[0]);
assertEquals("Respiratory, allergy and skin characteristics", r.getStringArray("string_array2")[0]);
assertEquals("Respiratory, allergy and skin characteristics2", r.getStringArray("string_array2")[1]);
}
}
Aggregations