Changeset 1830 for trunk/test


Ignore:
Timestamp:
May 10, 2011, 3:44:15 PM (9 years ago)
Author:
s.h.sikkema@…
Message:

Clarified error messages related to unreachable module; added functionality to export numbers using comma as decimal separator and made this the default for european csv style export

File:
1 edited

Legend:

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

    r1828 r1830  
    271271        // - is the custom delimiter (e.g. tab, comma, semicolon) correctly handled
    272272        // - null values are exported as empty strings
     273        // - possibility to use comma's as decimal separators
     274        // - 2.0 -> 2 and 2.1 -> 2.1
     275        // - no thousand separators
    273276
    274277        def rowData = [["""a
    275 b""","a,b","a\"b", "abc"],[1,2.0,"3,1"],[null,2]]
     278b""","a,b","a\"b", "abc"],[1,2.1,"3,1"],[null,2, 2.0, 2000]]
    276279
    277280        def baos = new ByteArrayOutputStream()
    278281
    279282        service.exportRowWiseDataToCSVFile rowData, baos, '\t'
    280         assertEquals 'CSV Output', '"a\nb"\t"a,b"\t"a""b"\tabc\n1\t2.0\t"3,1"\n\t2', baos.toString()
     283        assertEquals 'CSV Output', '"a\nb"\t"a,b"\t"a""b"\tabc\n1\t2.1\t"3,1"\n\t2\t2\t2000', baos.toString()
    281284
    282285        baos.reset()
    283286
    284287        service.exportRowWiseDataToCSVFile rowData, baos, ','
    285         assertEquals 'CSV Output', '"a\nb","a,b","a""b",abc\n1,2.0,"3,1"\n,2', baos.toString()
     288        assertEquals 'CSV Output', '"a\nb","a,b","a""b",abc\n1,2.1,"3,1"\n,2,2,2000', baos.toString()
    286289
    287290        baos.reset()
    288291
    289         service.exportRowWiseDataToCSVFile rowData, baos, ';'
    290         assertEquals 'CSV Output', '"a\nb";"a,b";"a""b";abc\n1;2.0;"3,1"\n;2', baos.toString()
     292        service.exportRowWiseDataToCSVFile rowData, baos, ';', java.util.Locale.GERMAN
     293        assertEquals 'CSV Output', '"a\nb";"a,b";"a""b";abc\n1;2,1;"3,1"\n;2;2;2000', baos.toString()
    291294
    292295
Note: See TracChangeset for help on using the changeset viewer.