- Timestamp:
- Jan 27, 2011, 1:43:36 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/dbnp/studycapturing/AssayControllerTests.groovy
r1430 r1445 18 18 protected void setUp() { 19 19 super.setUp() 20 mockDomain(Assay, [new Assay(id:1)]) 20 21 } 21 22 … … 25 26 26 27 void testWrongAssayID() { 27 mockParams.assayId = 128 mockParams.assayId = 3 28 29 29 30 controller.exportAssayAsExcel() … … 34 35 35 36 void testExceptionHandling() { 37 mockParams.assayId = 1 38 39 controller.metaClass.'grailsApplication' = [ 40 config: [modules: [metabolomics: [url: 'www.ab.com']]] 41 ] 42 36 43 controller.assayService = [ 37 collectAssayData:{a, b -> throw new Exception('msg1')}, 38 exportColumnWiseDataToExcelFile:{a, b -> throw new Exception('msg2')} 44 45 collectAssayData: {a, b -> def e = new Exception('msga'); e.metaClass.cause = new Exception('msg1'); throw e }, 46 exportColumnWiseDataToExcelFile: {a, b -> def e = new Exception('msgb'); e.metaClass.cause = new Exception('msg2'); throw e } 47 39 48 ] 49 40 50 controller.exportAssayAsExcel() 41 51 42 52 assertEquals 'Redirected action should match', [action: 'selectAssay'], redirectArgs 43 assertEquals 'Error message', ' java.lang.Exception:msg1', mockFlash.errorMessage53 assertEquals 'Error message', 'msg1', mockFlash.errorMessage 44 54 45 55 controller.assayService.collectAssayData = {a, b -> true} … … 47 57 48 58 assertEquals 'Redirected action should match', [action: 'selectAssay'], redirectArgs 49 assertEquals 'Error message', ' java.lang.Exception:msg2', mockFlash.errorMessage59 assertEquals 'Error message', 'msg2', mockFlash.errorMessage 50 60 51 61 }
Note: See TracChangeset
for help on using the changeset viewer.