use of org.molgenis.oneclickimporter.model.DataCollection in project molgenis by molgenis.
the class OneClickImporterServiceTest method testBuildDataSheetWithValidFormulaFile.
@Test
public void testBuildDataSheetWithValidFormulaFile() throws IOException, InvalidFormatException, URISyntaxException, EmptySheetException {
List<Sheet> sheets = loadSheetFromFile(OneClickImporterServiceTest.class, "/valid-with-formula.xlsx");
DataCollection actual = oneClickImporterService.buildDataCollectionsFromExcel(sheets).get(0);
Column c1 = Column.create("name", 0, newArrayList("Mark", "Mariska"));
Column c2 = Column.create("age", 1, newArrayList(26.0, 22.0));
DataCollection expected = DataCollection.create("Sheet1", newArrayList(c1, c2));
assertEquals(actual, expected);
}
use of org.molgenis.oneclickimporter.model.DataCollection in project molgenis by molgenis.
the class OneClickImporterServiceTest method testBuildDataCollectionWithComplexValidCsvFile.
@Test
public void testBuildDataCollectionWithComplexValidCsvFile() throws IOException, URISyntaxException {
oneClickImporterService = new OneClickImporterServiceImpl();
List<String[]> lines = loadLinesFromFile(OneClickImporterServiceTest.class, "/complex-valid.csv");
DataCollection actual = oneClickImporterService.buildDataCollectionFromCsv("complex-valid", lines);
Column c1 = Column.create("first name", 0, newArrayList("Mark", "Fleur", "Dennis", "Bart", "Sido", "Mariska", "Tommy", "Connor", "Piet", "Jan"));
Column c2 = Column.create("last name", 1, newArrayList("de Haan", "Kelpin", "Hendriksen", "Charbon", "Haakma", "Slofstra", "de Boer", "Stroomberg", "Klaassen", null));
Column c3 = Column.create("full name", 2, newArrayList("Mark de Haan", "Fleur Kelpin", "Dennis Hendriksen", "Bart Charbon", "Sido Haakma", "Mariska Slofstra", "Tommy de Boer", "Connor Stroomberg", "Piet Klaassen", null));
Column c4 = Column.create("UMCG employee", 3, newArrayList(true, true, true, true, true, true, true, true, false, false));
Column c5 = Column.create("Age", 4, newArrayList(26.4f, null, null, null, null, 22, 27, null, 53, 0.123f));
DataCollection expected = DataCollection.create("complex-valid", newArrayList(c1, c2, c3, c4, c5));
assertEquals(actual, expected);
}
use of org.molgenis.oneclickimporter.model.DataCollection in project molgenis by molgenis.
the class OneClickImporterServiceTest method testBuildDataCollectionWithSimpleValidCsvFile.
@Test
public void testBuildDataCollectionWithSimpleValidCsvFile() throws IOException, URISyntaxException {
oneClickImporterService = new OneClickImporterServiceImpl();
List<String[]> lines = loadLinesFromFile(OneClickImporterServiceTest.class, "/simple-valid.csv");
DataCollection actual = oneClickImporterService.buildDataCollectionFromCsv("simple-valid", lines);
Column c1 = Column.create("name", 0, newArrayList("Mark", "Connor", "Fleur", "Dennis"));
Column c2 = Column.create("superpower", 1, newArrayList("arrow functions", "Oldschool syntax", "Lambda Magician", "Root access"));
DataCollection expected = DataCollection.create("simple-valid", newArrayList(c1, c2));
assertEquals(actual, expected);
}
Aggregations