@Test public void groupByCountryTest() { assertEquals(8, csv1.groupCSVByCountry("DZA").size()); assertEquals(27, csv2.groupCSVByCountry("DZA").size()); assertEquals(8, csv1.groupCSVByCountry("SWE").size()); assertEquals(27, csv2.groupCSVByCountry("SWE").size()); }
@Test public void groupReadRecords() { List<CSVRecord> list = new LinkedList<CSVRecord>(); list.addAll(csv1.groupCSVByCountry("DZA")); list.addAll(csv2.groupCSVByCountry("DZA")); for (CSVRecord record : list) { assertEquals(4, record.get(YEAR.toString()).length()); } }
@Test public void testARG() { final String COUNTRY = "ARG"; List<CSVRecord> records1 = csv1.groupCSVByCountry(COUNTRY); List<CSVRecord> records2 = csv2.groupCSVByCountry(COUNTRY); CSVParser parser = new CSVParser(COUNTRY, headers, records1, records2); parser.setPrettyHeader(csv1.getPrettyHeader(), csv2.getPrettyHeader()); parser.toBasicValuesList(); }
@Before public void csvLoadingTest() throws FileNotFoundException, IOException { File file1 = TestData.file(this, "22_Aug_2014_P_version_for_FRIMS_update_entryItemAdded.csv"); File file2 = TestData.file(this, "22_August_Annual_F_for_FRIMS_update_entryItemAdded.csv"); csv1 = new CSVLoader(file1.getAbsolutePath()); csv2 = new CSVLoader(file2.getAbsolutePath()); assertNotNull(csv1.getHeader()); assertNotNull(csv2.getHeader()); headers = new LinkedHashSet<Map<String, Integer>>(); headers.add(csv1.getHeader()); headers.add(csv2.getHeader()); assertEquals(1872, csv1.countCSVRecords()); assertEquals(234, csv1.getCountries().size()); assertEquals(6318, csv2.countCSVRecords()); assertEquals(234, csv2.getCountries().size()); List<CSVRecord> records1 = csv1.groupCSVByCountry("DZA"); List<CSVRecord> records2 = csv2.groupCSVByCountry("DZA"); anExampleRecordFromCSV1 = records1.get(7); anExampleRecordFromCSV2 = records2.get(9); csvParser = new CSVParser("DZA", headers, records1, records2); csvParser.setPrettyHeader(csv1.getPrettyHeader(), csv2.getPrettyHeader()); }