Changeset 737 for trunk/test
- Timestamp:
- Jul 27, 2010, 5:22:45 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/integration/gscf/SampleTests.groovy
r663 r737 25 25 // This test extends StudyTests, so that we have a test study to assign as a parent study 26 26 27 final String testSampleName = "Test sample "27 final String testSampleName = "Test sample @XYZ!" 28 28 final String testSampleTemplateName = "Human blood sample" 29 29 … … 106 106 } 107 107 108 void testDelete() { 109 def sampleDB = Sample.findByName(testSampleName) 110 sampleDB.delete() 111 try { 112 sampleDB.save() 113 assert false // The save should not succeed since the sample is referenced by a study 114 } 115 catch(org.springframework.dao.InvalidDataAccessApiUsageException e) { 116 sampleDB.discard() 117 assert true // OK, correct exception (at least for the in-mem db, for PostgreSQL it's probably a different one...) 118 } 119 120 // Now, delete the sample from the study samples collection, and then the delete action should be cascaded to the sample itself 121 def study = Study.findByTitle(testStudyName) 122 assert study 123 study.removeFromSamples sampleDB 124 125 // Make sure the sample doesn't exist anymore at this point 126 assert !Sample.findByName(testSampleName) 127 assert study.samples.size() == 0 128 } 129 108 130 void testStudyRelation() { 109 131 // Retrieve the parent study
Note: See TracChangeset
for help on using the changeset viewer.