6060 *
6161 * @author Leon Yang
6262 */
63+ @ SuppressWarnings ("rawtypes" )
6364public class DefaultTableIOPluginTest {
6465
6566 private static final Context ctx = new Context ();
@@ -95,7 +96,7 @@ public void testParser() {
9596 "123.000\t -123.000\t 123.000\t 123.000\t 0.000\n " +
9697 "0.000\t 1234567890.099\t NaN\t -Infinity\t 0.000\n " ;
9798
98- final IOPlugin <GenericTable > tableIO = ctx .service (IOService .class )
99+ final IOPlugin <Table > tableIO = ctx .service (IOService .class )
99100 .getInstance (DefaultTableIOPlugin .class );
100101 try {
101102 final Function <String , Double > parser = Double ::valueOf ;
@@ -106,7 +107,7 @@ public void testParser() {
106107 "cornerText" , "parser" , "formatter" }, new Object [] { true , true , false ,
107108 true , "\t " , "\n " , "\" " , "\\ " , parser , formatter });
108109
109- final GenericTable table = openTable (tableSource , tableIO );
110+ final Table table = openTable (tableSource , tableIO );
110111 assertTableEquals (colHeaders , rowHeaders , content , table );
111112 assertEquals (expected , saveTable (table , tableIO ));
112113 }
@@ -140,7 +141,7 @@ public void testQuote() {
140141 "'should\t not,break',unnecessary_quotes,should,break\r \n " +
141142 "'some,empty,cells','','',''\r \n " ;
142143
143- final IOPlugin <GenericTable > tableIO = ctx .service (IOService .class )
144+ final IOPlugin <Table > tableIO = ctx .service (IOService .class )
144145 .getInstance (DefaultTableIOPlugin .class );
145146 try {
146147 setValues (tableIO , new String [] { "readColHeaders" , "writeColHeaders" ,
@@ -149,7 +150,7 @@ public void testQuote() {
149150 true , " " , "\r \n " , '\'' , "CORNER_TEXT" , Function .identity (), Function
150151 .identity () });
151152
152- final GenericTable table = openTable (tableSource , tableIO );
153+ final Table table = openTable (tableSource , tableIO );
153154 assertTableEquals (colHeaders , rowHeaders , content , table );
154155
155156 setValues (tableIO , new String [] { "separator" }, new Object [] { ',' });
@@ -181,10 +182,10 @@ public void testSmallTables() {
181182 final Double [][] content = { { 3.1415926 } };
182183 final Double [][] emptyContent = { {} };
183184
184- final IOPlugin <GenericTable > tableIO = ctx .service (IOService .class )
185+ final IOPlugin <Table > tableIO = ctx .service (IOService .class )
185186 .getInstance (DefaultTableIOPlugin .class );
186187 try {
187- GenericTable table ;
188+ Table table ;
188189 String expected ;
189190 final Function <String , Double > parser = Double ::valueOf ;
190191 final Function <Double , String > formatter = val -> String .format ("%.3f" ,
@@ -238,7 +239,7 @@ public void testSmallTables() {
238239
239240 @ Test (expected = IOException .class )
240241 public void testOpenNonExist () throws IOException {
241- final IOPlugin <GenericTable > tableIO = ctx .service (IOService .class )
242+ final IOPlugin <Table > tableIO = ctx .service (IOService .class )
242243 .getInstance (DefaultTableIOPlugin .class );
243244 tableIO .open ("fake.csv" );
244245 }
@@ -250,7 +251,7 @@ public void testOpenNonExist() throws IOException {
250251 */
251252 private void assertTableEquals (final String [] colHeaders ,
252253 final String [] rowHeaders , final Object [][] content ,
253- final GenericTable table )
254+ final Table table )
254255 {
255256 assertEquals (colHeaders .length , table .getColumnCount ());
256257 assertEquals (rowHeaders .length , table .getRowCount ());
@@ -265,11 +266,11 @@ private void assertTableEquals(final String[] colHeaders,
265266 }
266267 }
267268
268- private GenericTable openTable (final String tableSource ,
269- final IOPlugin <GenericTable > tableIO ) throws IOException
269+ private Table openTable (final String tableSource ,
270+ final IOPlugin <Table > tableIO ) throws IOException
270271 {
271272 final DataHandleService dataHandleService = ctx .service (DataHandleService .class );
272- GenericTable result ;
273+ Table result ;
273274 File tempFile = File .createTempFile ("openTest" , ".txt" );
274275 tempFiles .add (tempFile );
275276 try (DataHandle <Location > destHandle = dataHandleService .create (new FileLocation (tempFile ))) {
@@ -279,8 +280,8 @@ private GenericTable openTable(final String tableSource,
279280 return result ;
280281 }
281282
282- private String saveTable (final GenericTable table ,
283- final IOPlugin <GenericTable > tableIO ) throws IOException
283+ private String saveTable (final Table table ,
284+ final IOPlugin <Table > tableIO ) throws IOException
284285 {
285286 final DataHandleService dataHandleService = ctx .service (DataHandleService .class );
286287 String result ;
0 commit comments