Ignore:
Timestamp:
May 9, 2011, 4:39:18 PM (11 years ago)
Author:
s.h.sikkema@…
Message:

added different assay export possibilities (tab delimited, csv (comma and semicolon);

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/dbnp/studycapturing/AssayServiceTests.groovy

    r1803 r1827  
    269269        // - double quotes should be escaped by double quotes ( " -> "" )
    270270        // - other strings and numbers should remain 'quoteless'
     271        // - is the custom delimiter (e.g. tab, comma, semicolon) correctly handled
    271272
    272273        def rowData = [["""a
     
    275276        def baos = new ByteArrayOutputStream()
    276277
    277         service.exportRowWiseDataToCSVFile rowData, baos
    278 
     278        service.exportRowWiseDataToCSVFile rowData, baos, '\t'
     279        assertEquals 'CSV Output', '"a\nb"\t"a,b"\t"a""b"\tabc\n1\t2.0\t"3,1"', baos.toString()
     280
     281        baos.reset()
     282
     283        service.exportRowWiseDataToCSVFile rowData, baos, ','
    279284        assertEquals 'CSV Output', '"a\nb","a,b","a""b",abc\n1,2.0,"3,1"', baos.toString()
    280285
     286        baos.reset()
     287
     288        service.exportRowWiseDataToCSVFile rowData, baos, ';'
     289        assertEquals 'CSV Output', '"a\nb";"a,b";"a""b";abc\n1;2.0;"3,1"', baos.toString()
     290
     291
    281292    }
    282293}
Note: See TracChangeset for help on using the changeset viewer.