View Javadoc
1   package org.melati.poem.test.throwing;
2   
3   import java.sql.Connection;
4   import java.sql.PreparedStatement;
5   import java.sql.ResultSet;
6   import java.sql.Statement;
7   
8   import org.melati.poem.Database;
9   import org.melati.poem.DatabaseInitialisationPoemException;
10  import org.melati.poem.ExecutingSQLPoemException;
11  import org.melati.poem.FieldContentsPoemException;
12  import org.melati.poem.GroupCapability;
13  import org.melati.poem.PoemDatabaseFactory;
14  import org.melati.poem.SQLSeriousPoemException;
15  import org.melati.poem.SimplePrepareFailedPoemException;
16  import org.melati.poem.SimpleRetrievalFailedPoemException;
17  import org.melati.poem.Column.LoadException;
18  import org.melati.poem.dbms.test.sql.Thrower;
19  
20  /**
21   * @author timp
22   * @since 22 Feb 2007
23   *
24   */
25  public class TableTest extends org.melati.poem.test.TableTest {
26  
27    public TableTest(String arg0) {
28      super(arg0);
29    }
30  
31    protected void setUp() throws Exception {
32      PoemDatabaseFactory.removeDatabase(getDatabaseName());
33      super.setUp();
34      assertEquals("org.melati.poem.dbms.test.HsqldbThrower",getDb().getDbms().getClass().getName());
35    }
36  
37    protected void tearDown() throws Exception {
38      try { 
39        super.tearDown();
40      } finally { 
41        PoemDatabaseFactory.removeDatabase(getDatabaseName());
42      }
43    }
44  
45    public Database getDatabase(String name) {
46      maxTrans = 8;
47      Database db = PoemDatabaseFactory.getDatabase(name, 
48          "jdbc:hsqldb:mem:" + name,
49          "sa", 
50          "",
51          "org.melati.poem.PoemDatabase",
52          "org.melati.poem.dbms.test.HsqldbThrower", 
53          false, 
54          false, 
55          false, maxTrans);
56      return db;
57    }
58  
59    public void test_getColumn() {
60      
61      // super.test_getColumn();
62    }
63  
64    public void test_newPersistent() {
65      
66      // super.test_newPersistent();
67    }
68  
69    public void testAddColumnAndCommitBigDecimal() {
70      
71      // super.testAddColumnAndCommitBigDecimal();
72    }
73  
74    public void testAddColumnAndCommitBinary() {
75      
76      // super.testAddColumnAndCommitBinary();
77    }
78  
79    public void testAddColumnAndCommitBoolean() {
80      
81      // super.testAddColumnAndCommitBoolean();
82    }
83  
84    public void testAddColumnAndCommitDate() {
85      
86      // super.testAddColumnAndCommitDate();
87    }
88  
89    public void testAddColumnAndCommitDeleted() throws Exception {
90      
91      // super.testAddColumnAndCommitDeleted();
92    }
93  
94    public void testAddColumnAndCommitDisplaylevel() {
95      
96      // super.testAddColumnAndCommitDisplaylevel();
97    }
98  
99    public void testAddColumnAndCommitDouble() {
100     
101     // super.testAddColumnAndCommitDouble();
102   }
103 
104   public void testAddColumnAndCommitInteger() {
105     
106     // super.testAddColumnAndCommitInteger();
107   }
108 
109   public void testAddColumnAndCommitIntegrityfix() {
110     
111     // super.testAddColumnAndCommitIntegrityfix();
112   }
113 
114   public void testAddColumnAndCommitLong() {
115     
116     // super.testAddColumnAndCommitLong();
117   }
118 
119   public void testAddColumnAndCommitNullableInteger() {
120     
121     // super.testAddColumnAndCommitNullableInteger();
122   }
123 
124   public void testAddColumnAndCommitPassword() {
125     
126     // super.testAddColumnAndCommitPassword();
127   }
128 
129   public void testAddColumnAndCommitSearchability() {
130     
131     // super.testAddColumnAndCommitSearchability();
132   }
133 
134   public void testAddColumnAndCommitString() {
135     
136     // super.testAddColumnAndCommitString();
137   }
138 
139   public void testAddColumnAndCommitTimestamp() {
140     
141     // super.testAddColumnAndCommitTimestamp();
142   }
143 
144   public void testAddColumnAndCommitTroid() {
145     
146     // super.testAddColumnAndCommitTroid();
147   }
148 
149   public void testAddColumnAndCommitType() {
150     
151     // super.testAddColumnAndCommitType();
152   }
153 
154   public void testAddListener() {
155     
156     // super.testAddListener();
157   }
158 
159   public void testAppendWhereClause() {
160     
161     // super.testAppendWhereClause();
162   }
163 
164   public void testCachedCountPersistent() {
165     //super.testCachedCountPersistent();
166   }
167 
168   public void testCachedCountPersistentBooleanBoolean() {
169     
170     // super.testCachedCountPersistentBooleanBoolean();
171   }
172 
173   public void testCachedCountString() {
174     
175     //super.testCachedCountString();
176   }
177 
178   public void testCachedCountStringBoolean() {
179     
180     // super.testCachedCountStringBoolean();
181   }
182 
183   public void testCachedCountStringBooleanBoolean() {
184     
185     // super.testCachedCountStringBooleanBoolean();
186   }
187 
188   public void testCachedExists() {
189     
190     // super.testCachedExists();
191   }
192 
193   public void testCachedSelection() {
194     
195     // super.testCachedSelection();
196   }
197 
198   public void testCachedSelectionField() {
199     
200     // super.testCachedSelectionField();
201   }
202 
203   public void testCachedSelectionType() {
204     
205     // super.testCachedSelectionType();
206   }
207 
208   public void testCanDeleteColumn() {
209     
210     // super.testCanDeleteColumn();
211   }
212 
213   public void testCanReadColumn() {
214     
215     // super.testCanReadColumn();
216   }
217 
218   public void testCanSelectColumn() {
219     
220     // super.testCanSelectColumn();
221   }
222 
223   public void testCanWriteColumn() {
224     
225     // super.testCanWriteColumn();
226   }
227 
228   public void testCnfWhereClauseEnumeration() {
229     
230     // super.testCnfWhereClauseEnumeration();
231   }
232 
233   public void testCnfWhereClauseEnumerationBooleanBoolean() {
234     
235     // super.testCnfWhereClauseEnumerationBooleanBoolean();
236   }
237 
238   public void testColumns() {
239     
240     // super.testColumns();
241   }
242 
243   public void testColumnWithColumnInfoID() {
244     
245     // super.testColumnWithColumnInfoID();
246   }
247 
248   public void testCount() {
249     Thrower.startThrowing(Connection.class, "createStatement");
250     try { 
251       super.testCount();
252       fail("Should have bombed");
253     } catch (ExecutingSQLPoemException e) { 
254       assertEquals("Connection bombed", e.innermostException().getMessage());
255     } finally {
256       Thrower.stopThrowing(Connection.class, "createStatement");
257     }
258   }
259 
260   public void testCountSQLString() {
261     
262     // super.testCountSQLString();
263   }
264 
265   public void testCountSQLStringStringBooleanBoolean() {
266     
267     // super.testCountSQLStringStringBooleanBoolean();
268   }
269 
270   public void testCountString() {
271     
272     // super.testCountString();
273   }
274 
275   public void testCountStringBoolean() {
276     
277     // super.testCountStringBoolean();
278   }
279 
280   public void testCountStringBooleanBoolean() {
281     
282     // super.testCountStringBooleanBoolean();
283   }
284 
285   public void testCreateInitialiser() {
286     
287     // super.testCreateInitialiser();
288   }
289 
290   public void testCreatePersistent() {
291     
292     // super.testCreatePersistent();
293   }
294 
295   public void testCreateTableInfo() {
296     
297     // super.testCreateTableInfo();
298   }
299 
300   public void testDbModifyStructure() {
301     
302     // super.testDbModifyStructure();
303   }
304 
305   public void testDefaultCacheLimit() {
306     
307     // super.testDefaultCacheLimit();
308   }
309 
310   public void testDefaultCategory() {
311     
312     // super.testDefaultCategory();
313   }
314 
315   public void testDefaultDescription() {
316     
317     // super.testDefaultDescription();
318   }
319 
320   public void testDefaultDisplayName() {
321     
322     // super.testDefaultDisplayName();
323   }
324 
325   public void testDefaultDisplayOrder() {
326     
327     // super.testDefaultDisplayOrder();
328   }
329 
330   public void testDefaultOrderByClause() {
331     
332     // super.testDefaultOrderByClause();
333   }
334 
335   public void testDefaultRememberAllTroids() {
336     
337     // super.testDefaultRememberAllTroids();
338   }
339 
340   public void testDefineColumnColumn() {
341     
342     // super.testDefineColumnColumn();
343   }
344 
345   public void testDefineColumnColumnBoolean() {
346     
347     // super.testDefineColumnColumnBoolean();
348   }
349 
350   public void testDelete_unsafe() {
351     
352     // super.testDelete_unsafe();
353   }
354 
355   public void testDelete() {
356     
357     // super.testDelete();
358   }
359 
360   public void testDeletedColumn() {
361     
362     // super.testDeletedColumn();
363   }
364 
365   public void testDisplayColumn() {
366     
367     // super.testDisplayColumn();
368   }
369 
370   public void testDisplayColumns() {
371     
372     // super.testDisplayColumns();
373   }
374 
375   public void testDisplayColumnsCount() {
376     
377     // super.testDisplayColumnsCount();
378   }
379 
380   public void testDump() {
381     
382     // super.testDump();
383   }
384 
385   public void testDumpCacheAnalysis() {
386     
387     // super.testDumpCacheAnalysis();
388   }
389 
390   public void testEqualsObject() {
391     
392     // super.testEqualsObject();
393   }
394 
395   public void testExistsPersistent() {
396     
397     // super.testExistsPersistent();
398   }
399 
400   public void testExistsString() {
401     
402     // super.testExistsString();
403   }
404 
405   public void testExtrasCount() {
406     
407     // super.testExtrasCount();
408   }
409 
410   public void testFirstSelection() {
411     
412     // super.testFirstSelection();
413   }
414 
415   public void testGetCacheInfo() {
416     
417     // super.testGetCacheInfo();
418   }
419 
420   public void testGetCanCreate() {
421     
422     // super.testGetCanCreate();
423   }
424 
425   public void testGetCategory() {
426     
427     // super.testGetCategory();
428   }
429 
430   public void testGetColumn() {
431     
432     // super.testGetColumn();
433   }
434 
435   public void testGetColumnsCount() {
436     
437     // super.testGetColumnsCount();
438   }
439 
440   public void testGetDatabase() {
441     
442     // super.testGetDatabase();
443   }
444 
445   public void testGetDefaultCanDelete() {
446     
447     // super.testGetDefaultCanDelete();
448   }
449 
450   public void testGetDefaultCanRead() {
451     
452     // super.testGetDefaultCanRead();
453   }
454 
455   public void testGetDefaultCanWrite() {
456     
457     // super.testGetDefaultCanWrite();
458   }
459 
460   public void testGetDescription() {
461     
462     // super.testGetDescription();
463   }
464 
465   public void testGetDetailDisplayColumns() {
466     
467     // super.testGetDetailDisplayColumns();
468   }
469 
470   public void testGetDetailDisplayColumnsCount() {
471     
472     // super.testGetDetailDisplayColumnsCount();
473   }
474 
475   public void testGetDisplayName() {
476     
477     // super.testGetDisplayName();
478   }
479 
480   public void testGetInfo() {
481     
482     // super.testGetInfo();
483   }
484 
485   public void testGetName() {
486     
487     // super.testGetName();
488   }
489 
490   public void testGetObjectInt() {
491     getDb().uncache();
492     Thrower.startThrowing(ResultSet.class, "next");
493     Thrower.startThrowing(ResultSet.class, "close");
494     try { 
495       super.testGetObjectInt();
496       fail("Should have blown up");
497     } catch (SimpleRetrievalFailedPoemException e) { 
498       assertEquals("ResultSet bombed", e.innermostException().getMessage());
499     } finally { 
500       Thrower.stopThrowing(ResultSet.class, "next");
501       Thrower.stopThrowing(ResultSet.class, "close");
502     }
503     getDb().uncache();
504     Thrower.startThrowing(ResultSet.class, "getInt");
505     try { 
506       super.testGetObjectInt();
507       fail("Should have blown up");
508     } catch (LoadException e) { 
509       assertEquals("ResultSet bombed", e.innermostException().getMessage());
510     } finally { 
511       Thrower.stopThrowing(ResultSet.class, "getInt");
512     }
513     // Force bomb of simpleGet
514     getDb().getGroupTable().invalidateTransactionStuffs();
515     Thrower.startThrowingAfter(Connection.class,"prepareStatement", 2);
516     try { 
517       super.testGetObjectInt();
518       fail("Should have blown up");
519     } catch (SimplePrepareFailedPoemException e) { 
520       e.printStackTrace();
521       assertEquals("Connection bombed", e.innermostException().getMessage());
522     } finally { 
523       Thrower.stopThrowing(Connection.class, "prepareStatement");
524     }
525     
526   }
527 
528   public void testGetObjectInteger() {
529     
530     // super.testGetObjectInteger();
531   }
532 
533   public void testGetRecordDisplayColumns() {
534     
535     // super.testGetRecordDisplayColumns();
536   }
537 
538   public void testGetRecordDisplayColumnsCount() {
539     
540     // super.testGetRecordDisplayColumnsCount();
541   }
542 
543   public void testGetSearchCriterionColumns() {
544     
545     // super.testGetSearchCriterionColumns();
546   }
547 
548   public void testGetSearchCriterionColumnsCount() {
549     
550     // super.testGetSearchCriterionColumnsCount();
551   }
552 
553   public void testGetSummaryDisplayColumns() {
554     
555     // super.testGetSummaryDisplayColumns();
556   }
557 
558   public void testGetSummaryDisplayColumnsCount() {
559     
560     // super.testGetSummaryDisplayColumnsCount();
561   }
562 
563   public void testGetTableInfo() {
564     
565     // super.testGetTableInfo();
566   }
567 
568   public void testHashCode() {
569     
570     // super.testHashCode();
571   }
572 
573   public void testInit() {
574     
575     // super.testInit();
576   }
577 
578   public void testLoad() {
579     
580     // super.testLoad();
581   }
582 
583   public void testNewPersistent() {
584     
585     // super.testNewPersistent();
586   }
587 
588   public void testNotifyColumnInfo() {
589     
590     // super.testNotifyColumnInfo();
591   }
592 
593   public void testNotifyTouched() {
594     
595     // super.testNotifyTouched();
596   }
597 
598   public void testPostInitialise() {
599     
600     // super.testPostInitialise();
601   }
602 
603   public void testPrimaryCriterionColumn() {
604     
605     // super.testPrimaryCriterionColumn();
606   }
607 
608   public void testQuotedName() {
609     
610     // super.testQuotedName();
611   }
612 
613   public void testReadLock() {
614     
615     // super.testReadLock();
616   }
617 
618   public void testReferencesToPersistent() {
619     
620     // super.testReferencesToPersistent();
621   }
622 
623   public void testReferencesToTable() {
624     
625     // super.testReferencesToTable();
626   }
627 
628   public void testRememberAllTroids() {
629     
630     // super.testRememberAllTroids();
631   }
632 
633   public void testSelection() {
634     
635     // super.testSelection();
636   }
637 
638   public void testSelectionPersistent() {
639     
640     // super.testSelectionPersistent();
641   }
642 
643   public void testSelectionPersistentString() {
644     
645     // super.testSelectionPersistentString();
646   }
647 
648   public void testSelectionPersistentStringBooleanBoolean() {
649     
650     // super.testSelectionPersistentStringBooleanBoolean();
651   }
652 
653 
654   /** 
655    * {@inheritDoc}
656    * @see org.melati.poem.test.TableTest#testSelectionSQLStringStringBoolean()
657    */
658   public void testSelectionSQLStringStringBoolean() {
659     
660     // super.testSelectionSQLStringStringBoolean();
661   }
662 
663   /** 
664    * {@inheritDoc}
665    * @see org.melati.poem.test.TableTest#testSelectionSQLStringStringStringBooleanBoolean()
666    */
667   public void testSelectionSQLStringStringStringBooleanBoolean() {
668     
669     // super.testSelectionSQLStringStringStringBooleanBoolean();
670   }
671 
672   /** 
673    * {@inheritDoc}
674    * @see org.melati.poem.test.TableTest#testSelectionString()
675    */
676   public void testSelectionString() {
677     
678     // super.testSelectionString();
679   }
680 
681   /** 
682    * {@inheritDoc}
683    * @see org.melati.poem.test.TableTest#testSelectionStringStringBoolean()
684    */
685   public void testSelectionStringStringBoolean() {
686     
687     // super.testSelectionStringStringBoolean();
688   }
689 
690 
691   /** 
692    * {@inheritDoc}
693    * @see org.melati.poem.test.TableTest#testSerial()
694    */
695   public void testSerial() {
696     
697     // super.testSerial();
698   }
699 
700   /** 
701    * {@inheritDoc}
702    * @see org.melati.poem.test.TableTest#testSetCacheLimit()
703    */
704   public void testSetCacheLimit() {
705     
706     // super.testSetCacheLimit();
707   }
708 
709   /** 
710    * {@inheritDoc}
711    * @see org.melati.poem.test.TableTest#testSetDisplayColumn()
712    */
713   public void testSetDisplayColumn() {
714     
715     // super.testSetDisplayColumn();
716   }
717 
718   /** 
719    * {@inheritDoc}
720    * @see org.melati.poem.test.TableTest#testSetSearchColumn()
721    */
722   public void testSetSearchColumn() {
723     
724     // super.testSetSearchColumn();
725   }
726 
727   /** 
728    * {@inheritDoc}
729    * @see org.melati.poem.test.TableTest#testSetTableInfo()
730    */
731   public void testSetTableInfo() {
732     
733     // super.testSetTableInfo();
734   }
735 
736   /** 
737    * {@inheritDoc}
738    * @see org.melati.poem.test.TableTest#testTable()
739    */
740   public void testTable() {
741     
742     // super.testTable();
743   }
744 
745   /** 
746    * {@inheritDoc}
747    * @see org.melati.poem.test.TableTest#testTableInfoID()
748    */
749   public void testTableInfoID() {
750     
751     // super.testTableInfoID();
752   }
753 
754   /** 
755    * {@inheritDoc}
756    * @see org.melati.poem.test.TableTest#testToString()
757    */
758   public void testToString() {
759     
760     // super.testToString();
761   }
762 
763   /** 
764    * {@inheritDoc}
765    * @see org.melati.poem.test.TableTest#testTrimCache()
766    */
767   public void testTrimCache() {
768     
769     // super.testTrimCache();
770   }
771 
772   /** 
773    * {@inheritDoc}
774    * @see org.melati.poem.test.TableTest#testTroidColumn()
775    */
776   public void testTroidColumn() {
777     
778     // super.testTroidColumn();
779   }
780 
781   /** 
782    * {@inheritDoc}
783    * @see org.melati.poem.test.TableTest#testTroidFor()
784    */
785   public void testTroidFor() {
786     
787     // super.testTroidFor();
788   }
789 
790   /** 
791    * {@inheritDoc}
792    * @see org.melati.poem.test.TableTest#testTroidSelectionPersistentStringBooleanBooleanPoemTransaction()
793    */
794   public void testTroidSelectionPersistentStringBooleanBooleanPoemTransaction() {
795     
796     //super.testTroidSelectionPersistentStringBooleanBooleanPoemTransaction();
797   }
798 
799   /** 
800    * {@inheritDoc}
801    * @see org.melati.poem.test.TableTest#testTroidSelectionStringStringBoolean()
802    */
803   public void testTroidSelectionStringStringBoolean() {
804     Thrower.startThrowing(Connection.class, "createStatement");
805     try { 
806       super.testTroidSelectionStringStringBoolean();
807       fail("Should have bombed");
808     } catch (ExecutingSQLPoemException e) { 
809       assertEquals("Connection bombed", e.innermostException().getMessage());
810     } finally { 
811       Thrower.stopThrowing(Connection.class, "createStatement");      
812     }
813   }
814 
815   /** 
816    * {@inheritDoc}
817    * @see org.melati.poem.test.TableTest#testTroidSelectionStringStringBooleanPoemTransaction()
818    */
819   public void testTroidSelectionStringStringBooleanPoemTransaction() {
820     
821     // super.testTroidSelectionStringStringBooleanPoemTransaction();
822   }
823 
824   /** 
825    * {@inheritDoc}
826    * @see org.melati.poem.test.TableTest#testUncacheContents()
827    */
828   public void testUncacheContents() {
829     
830     // super.testUncacheContents();
831   }
832 
833   /** 
834    * {@inheritDoc}
835    * @see org.melati.poem.test.TableTest#testUnifyWithColumnInfo()
836    */
837   public void testUnifyWithColumnInfo() {
838     
839     // super.testUnifyWithColumnInfo();
840   }
841 
842   /** 
843    * {@inheritDoc}
844    * @see org.melati.poem.test.TableTest#testUnifyWithDB()
845    */
846   public void testUnifyWithDB() {
847     
848     // super.testUnifyWithDB();
849   }
850 
851   /** 
852    * {@inheritDoc}
853    * @see org.melati.poem.test.TableTest#testWhereClausePersistent()
854    */
855   public void testWhereClausePersistent() {
856     
857     // super.testWhereClausePersistent();
858   }
859 
860   /** 
861    * {@inheritDoc}
862    * @see org.melati.poem.test.TableTest#testWhereClausePersistentBooleanBoolean()
863    */
864   public void testWhereClausePersistentBooleanBoolean() {
865     
866     // super.testWhereClausePersistentBooleanBoolean();
867   }
868 
869   /**
870    * Test write down bombs. 
871    */
872   public void testWriteDown() {
873     Thrower.startThrowing(PreparedStatement.class, "setInt");
874     try { 
875       super.testWriteDown();
876       fail("Should have blown up");
877     } catch (FieldContentsPoemException e) { 
878       assertEquals("PreparedStatement bombed", e.innermostException().getMessage());
879     } finally { 
880       Thrower.stopThrowing(PreparedStatement.class, "setInt");
881     }
882     
883   }
884 
885   /**
886    * Test write down bombs. 
887    */
888   public void testWriteDown2() {
889     Thrower.startThrowing(PreparedStatement.class, "executeUpdate");
890     try { 
891       super.testWriteDown();
892       fail("Should have blown up");
893     } catch (ExecutingSQLPoemException e) { 
894       assertEquals("PreparedStatement bombed", e.innermostException().getMessage());
895     } finally { 
896       Thrower.stopThrowing(PreparedStatement.class, "executeUpdate");
897     }
898   }
899 
900   /**
901    * Test write down bombs. 
902    */
903   public void testWriteDown3() {
904     Thrower.startThrowingAfter(PreparedStatement.class,"setInt", 1);
905     try { 
906       super.testWriteDown();
907       fail("Should have blown up");
908     } catch (SQLSeriousPoemException e) { 
909       assertEquals("PreparedStatement bombed", e.innermostException().getMessage());
910     } finally { 
911       Thrower.stopThrowing(PreparedStatement.class, "setInt");
912     }
913   }
914 
915   /**
916    * Test write down bombs. 
917    */
918   public void testWriteDownInsert() {
919     Thrower.startThrowing(Connection.class, "prepareStatement");
920     try { 
921       getDb().getGroupCapabilityTable().invalidateTransactionStuffs();
922       GroupCapability g = (GroupCapability)getDb().getGroupCapabilityTable().newPersistent();
923       g.setGroup_unsafe(new Integer(0));
924       g.setCapability_unsafe(new Integer(0));
925       g.makePersistent();
926       fail("Should have blown up");
927     } catch (SimplePrepareFailedPoemException e) { 
928       assertEquals("Connection bombed", e.innermostException().getMessage());
929     } finally { 
930       Thrower.stopThrowing(Connection.class, "prepareStatement");
931     }
932   }
933 
934   /**
935    * Test write down bombs. 
936    */
937   public void testWriteDownModify() {
938     Thrower.startThrowingAfter(Connection.class,"prepareStatement", 1);
939     getDb().getUserTable().invalidateTransactionStuffs();
940     try { 
941       super.testWriteDown();
942       fail("Should have blown up");
943     } catch (SimplePrepareFailedPoemException e) { 
944       assertEquals("Connection bombed", e.innermostException().getMessage());
945     } finally { 
946       Thrower.stopThrowing(Connection.class, "prepareStatement");
947     }
948   }
949 
950   /**
951    * Test write down bombs. 
952    */
953   public void testWriteDown5() {
954     Thrower.startThrowing(PreparedStatement.class, "executeUpdate");
955     try { 
956       getDb().getGroupCapabilityTable().invalidateTransactionStuffs();
957       GroupCapability g = (GroupCapability)getDb().getGroupCapabilityTable().newPersistent();
958       g.setGroup_unsafe(new Integer(0));
959       g.setCapability_unsafe(new Integer(0));
960       g.makePersistent();
961       fail("Should have blown up");
962     } catch (ExecutingSQLPoemException e) { 
963       assertEquals("PreparedStatement bombed", e.innermostException().getMessage());
964     } finally { 
965       Thrower.stopThrowing(PreparedStatement.class, "executeUpdate");
966     }
967   }
968 
969   /**
970    * Test write down bombs.
971    */
972   public void testWriteDownDelete() {
973     GroupCapability g = (GroupCapability)getDb().getGroupCapabilityTable().newPersistent();
974     g.setGroup_unsafe(new Integer(0));
975     g.setCapability_unsafe(new Integer(0));
976     g.makePersistent();
977     Thrower.startThrowing(Statement.class, "executeUpdate");
978     getDb().getGroupCapabilityTable().invalidateTransactionStuffs();
979     try { 
980       g.delete();
981       fail("Should have blown up");
982     } catch (ExecutingSQLPoemException e) { 
983       assertEquals("Statement bombed", e.innermostException().getMessage());
984     } finally { 
985       Thrower.stopThrowing(Statement.class, "executeUpdate");
986       g.delete();
987     }
988   }
989 
990   /**
991    * Test that the next troid bombs.
992    */
993   public void testNextTroidBombs() { 
994     Thrower.startThrowing(Statement.class, "close");
995     PoemDatabaseFactory.removeDatabase("melatijunit");
996     try { 
997       getDb();
998       fail("Should have blown up");
999     } catch (DatabaseInitialisationPoemException e) { 
1000       e.printStackTrace();
1001       assertEquals("Statement bombed", e.innermostException().getMessage());
1002     } finally { 
1003       Thrower.stopThrowing(Statement.class, "close");
1004     }
1005   }
1006 }