[jsword-svn] r2127 - trunk/jsword/src/test/java/org/crosswire/jsword/book/sword

dmsmith at crosswire.org dmsmith at crosswire.org
Mon Mar 14 16:39:24 MST 2011


Author: dmsmith
Date: 2011-03-14 16:39:24 -0700 (Mon, 14 Mar 2011)
New Revision: 2127

Modified:
   trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/GenBookTest.java
Log:
JS-177 Test case for npe problem in GenBookBackend

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/GenBookTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/GenBookTest.java	2011-03-14 21:52:19 UTC (rev 2126)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/GenBookTest.java	2011-03-14 23:39:24 UTC (rev 2127)
@@ -56,5 +56,18 @@
             assertEquals("Incorrect number of top level keys", 6, globalKeyList.getChildCount());
         }
     }
+    public void testInvalidKey() {
+        Book book = Books.installed().getBook("Pilgrim");
+        if (book != null) {
+            Key key = book.getGlobalKeyList();
+            try {
+                book.getRawText(key);
+            } catch (NullPointerException e) {
+                Assert.fail("test for bad key should not have thrown an NPE.");
+            } catch (BookException e) {
+                assertEquals("testing for a bad key", "No entry for '' in Pilgrim.", e.getMessage());
+            }
+        }
+    }
 
 }




More information about the jsword-svn mailing list