2020-05-19 18:43:42 +02:00
|
|
|
|
2020-05-19 18:42:50 +02:00
|
|
|
package eu.dnetlib.dhp.actionmanager.project;
|
|
|
|
|
2020-05-19 18:43:42 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2020-05-19 18:42:50 +02:00
|
|
|
import org.apache.commons.io.IOUtils;
|
2020-10-01 10:34:48 +02:00
|
|
|
import org.junit.jupiter.api.Assertions;
|
2020-05-19 18:42:50 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2020-10-01 10:34:48 +02:00
|
|
|
import eu.dnetlib.dhp.actionmanager.project.utils.CSVParser;
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-05-19 18:43:42 +02:00
|
|
|
public class CSVParserTest {
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-05-19 18:43:42 +02:00
|
|
|
@Test
|
|
|
|
public void readProgrammeTest() throws Exception {
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-05-19 18:43:42 +02:00
|
|
|
String programmecsv = IOUtils
|
|
|
|
.toString(
|
|
|
|
getClass()
|
|
|
|
.getClassLoader()
|
|
|
|
.getResourceAsStream("eu/dnetlib/dhp/actionmanager/project/programme.csv"));
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-05-19 18:43:42 +02:00
|
|
|
CSVParser csvParser = new CSVParser();
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-10-01 10:34:48 +02:00
|
|
|
List<Object> pl = csvParser.parse(programmecsv, "eu.dnetlib.dhp.actionmanager.project.utils.CSVProgramme");
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-10-01 10:34:48 +02:00
|
|
|
Assertions.assertEquals(24, pl.size());
|
2020-05-19 18:42:50 +02:00
|
|
|
|
2020-05-19 18:43:42 +02:00
|
|
|
}
|
2020-10-01 10:34:48 +02:00
|
|
|
|
2020-05-19 18:42:50 +02:00
|
|
|
}
|