From d6f22a2af48f83d63b5381118d2029797458194e Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sat, 20 Sep 2014 09:17:18 +0200 Subject: Early development stages (before SCM) : WIP_1 Early development stages (before SCM) : WIP_2 Early development stages (before SCM) : WIP_3 Early development stages (before SCM) : WIP_4 Early development stages (before SCM) : WIP_6 Early development stages (before SCM) : WIP_7 Early development stages (before SCM) : WIP_8 Adds documentation folder as an Eclipse project. Adds README for github. Decent source tree by tuning Eclise project's location One forgetten file while movign everything :) Adding Copyright, licencing (GPL v3), correcting README --- .../JUTests/data/io/csv/CSVDataReaderTest.java | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/connectors/JUTests/data/io/csv/CSVDataReaderTest.java (limited to 'src/connectors/JUTests/data/io/csv') diff --git a/src/connectors/JUTests/data/io/csv/CSVDataReaderTest.java b/src/connectors/JUTests/data/io/csv/CSVDataReaderTest.java new file mode 100644 index 0000000..6a0e053 --- /dev/null +++ b/src/connectors/JUTests/data/io/csv/CSVDataReaderTest.java @@ -0,0 +1,50 @@ +package data.io.csv; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.io.StringReader; +import java.util.Iterator; + +import org.junit.Test; + +import data.MVDataEntry; + +public class CSVDataReaderTest { + + + @Test + public void testNext() throws IOException { + CSVDataReader reader = new CSVDataReader( + "testNext", + new StringReader(CSVDataReader.CSV_DEMO), + false + ); + + MVDataEntry expected[] = new MVDataEntry[3]; + expected[0]=new MVDataEntry("line1"); + expected[0].splitAndPut("from", "csv1;csv1bis", ";"); + expected[0].splitAndPut("attr2","csv1",";"); + + expected[1]=new MVDataEntry("line2"); + expected[1].splitAndPut("hello", "all;the;world", ";"); + + expected[2]=new MVDataEntry("line3"); + expected[2].splitAndPut("hello", "all;the;others", ";"); + + // Test twice to check if asking a new iterator "rewinds" correctly + for (int i=0;i<2;i++) { + System.out.println("Loop " + (i+1)); + Iterator readerIt = reader.iterator(); + + for ( MVDataEntry e: expected) { + assertTrue(readerIt.hasNext()); + MVDataEntry r = readerIt.next(); + System.out.println(e + " / " + r); + assertEquals(e, r); + } + assertFalse(readerIt.hasNext()); + } + } + +} -- cgit v1.2.3