Search in sources :

Example 81 with LabeledCSVParser

use of com.Ostermiller.util.LabeledCSVParser in project eol-globi-data by jhpoelen.

the class LengthRangeParserImplTest method parseLengthMalformed.

@Test(expected = StudyImporterException.class)
public void parseLengthMalformed() throws IOException, StudyImporterException {
    LengthRangeParserImpl parser = new LengthRangeParserImpl("johnny");
    LabeledCSVParser csvParser = new TestParserFactory("johnny\nAINTRIGHT\n324\n").createParser("aStudy", "UTF-8");
    csvParser.getLine();
    parser.parseLengthInMm(csvParser);
}
Also used : LabeledCSVParser(com.Ostermiller.util.LabeledCSVParser) Test(org.junit.Test)

Example 82 with LabeledCSVParser

use of com.Ostermiller.util.LabeledCSVParser in project eol-globi-data by jhpoelen.

the class StudyImporterForRaymondTest method importPartialStudy.

@Test
public void importPartialStudy() throws IOException, StudyImporterException {
    StudyImporterForRaymond importer = new StudyImporterForRaymond(new ParserFactoryLocal(), nodeFactory);
    LabeledCSVParser dietParser = CSVTSVUtil.createLabeledCSVParser(new StringReader(firstFewLinesOfDiet()));
    LabeledCSVParser sourcesParser = CSVTSVUtil.createLabeledCSVParser(new StringReader(firstFewLinesOfSourcesAlteredToFitDietDataSample()));
    importer.importData(sourcesParser, dietParser);
    assertThatAllStudiesHaveAtLeastOneInteraction();
}
Also used : StringReader(java.io.StringReader) LabeledCSVParser(com.Ostermiller.util.LabeledCSVParser) Test(org.junit.Test)

Aggregations

LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)82 IOException (java.io.IOException)40 Test (org.junit.Test)31 Study (org.eol.globi.domain.Study)24 StudyImpl (org.eol.globi.domain.StudyImpl)17 Specimen (org.eol.globi.domain.Specimen)15 HashMap (java.util.HashMap)13 ArrayList (java.util.ArrayList)12 Location (org.eol.globi.domain.Location)12 TaxonImpl (org.eol.globi.domain.TaxonImpl)12 CSVParser (com.Ostermiller.util.CSVParser)10 StringReader (java.io.StringReader)8 LocationImpl (org.eol.globi.domain.LocationImpl)8 Taxon (org.eol.globi.domain.Taxon)8 InteractType (org.eol.globi.domain.InteractType)7 File (java.io.File)6 FileInputStream (java.io.FileInputStream)6 InputStream (java.io.InputStream)6 Date (java.util.Date)6 List (java.util.List)6