Ignore:
Timestamp:
Feb 24, 2011, 5:14:08 PM (10 years ago)
Author:
s.h.sikkema@…
Message:

Assay export functionality

File:
1 edited

Legend:

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

    r1455 r1559  
    2626
    2727    void testWrongAssayID() {
    28         mockParams.assayId = 3
     28        mockFlash.assayId = 3
    2929
    30         controller.exportAssayAsExcel()
     30        controller.compileExportData()
    3131
    3232        assertEquals 'Redirected action should match', [action: 'selectAssay'], redirectArgs
    33         assertEquals 'Error message', 'No assay found with id: 3.', mockFlash.errorMessage
     33        assertEquals 'Error message', 'No assay found with id: 3', mockFlash.errorMessage
    3434    }
    3535
    3636    void testExceptionHandling() {
    37         mockParams.assayId = 1
     37        mockFlash.assayId = 1
    3838
    3939        controller.metaClass.'grailsApplication' = [
     
    4343        controller.assayService = [
    4444
    45                 collectAssayData:                   {a, b -> throw new Exception('msg1') },
    46                 exportColumnWiseDataToExcelFile:    {a, b -> throw new Exception('msg2') }
     45                collectAssayData:               {a, b, c -> throw new Exception('msg1') },
     46                convertColumnToRowStructure:    {a -> throw new Exception('msg2')},
     47                exportRowWiseDataToExcelFile:   {a, b -> throw new Exception('msg3') }
    4748
    4849        ]
    4950
    50         controller.exportAssayAsExcel()
     51        controller.compileExportData()
    5152
    5253        assertEquals 'Redirected action should match', [action: 'selectAssay'], redirectArgs
    5354        assertEquals 'Error message', 'msg1', mockFlash.errorMessage
    5455
    55         controller.assayService.collectAssayData = {a, b -> true}
    56         controller.exportAssayAsExcel()
     56        controller.assayService.collectAssayData = {a, b, c -> true}
     57        controller.compileExportData()
    5758
    5859        assertEquals 'Redirected action should match', [action: 'selectAssay'], redirectArgs
    5960        assertEquals 'Error message', 'msg2', mockFlash.errorMessage
    6061
     62        controller.doExport()
     63
     64        assertEquals 'Redirected action should match', [action: 'selectAssay'], redirectArgs
     65        assertEquals 'Error message', 'msg3', mockFlash.errorMessage
     66
    6167    }
    6268
Note: See TracChangeset for help on using the changeset viewer.