@Test public void testRealLifeCsvWithMalformedTime() throws Exception { try { final String url = this.getClass().getResource("/point-data-bad-time-format.txt").toExternalForm(); MAConfig maConfig = new MAConfig(); maConfig.setRecordSourceUrl(url); final RecordSource recordSource = maConfig.createRecordSource(new Configuration()); Iterable<Record> records = recordSource.getRecords(); for (Record record : records) { record.getTime(); } fail("error not detected"); } catch (Exception e) { assertEquals("time value '08.05.2006' in line 3 column 3 of point data file not well-formed (pattern yyyy-MM-dd HH:mm:ss expected)", e.getMessage()); } }
@Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new CsvRecordIterator(); } }; }
CsvRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new CsvRecordIterator(); } }; } }
CsvRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new CsvRecordIterator(); } }; } CsvRecordSource(Reader reader, DateFormat dateFormat); }
CsvRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new CsvRecordIterator(); } }; } CsvRecordSource(Reader reader, DateFormat dateFormat); @Override Header getHeader(); @Override Iterable<Record> getRecords(); @Override String getTimeAndLocationColumnDescription(); static Object[] toObjects(String[] textValues, Class<?>[] types); }
CsvRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new CsvRecordIterator(); } }; } CsvRecordSource(Reader reader, DateFormat dateFormat); @Override Header getHeader(); @Override Iterable<Record> getRecords(); @Override String getTimeAndLocationColumnDescription(); static Object[] toObjects(String[] textValues, Class<?>[] types);  }