[jsword-svn] r2209 - in trunk/jsword/src/test/java/org/crosswire/jsword: . versification
dmsmith at crosswire.org
dmsmith at crosswire.org
Sat Jan 14 07:06:50 MST 2012
Author: dmsmith
Date: 2012-01-14 07:06:50 -0700 (Sat, 14 Jan 2012)
New Revision: 2209
Added:
trunk/jsword/src/test/java/org/crosswire/jsword/versification/
trunk/jsword/src/test/java/org/crosswire/jsword/versification/AllTests.java
trunk/jsword/src/test/java/org/crosswire/jsword/versification/BookNameTest.java
Log:
beefing up JUnit tests
Added: trunk/jsword/src/test/java/org/crosswire/jsword/versification/AllTests.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/versification/AllTests.java (rev 0)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/versification/AllTests.java 2012-01-14 14:06:50 UTC (rev 2209)
@@ -0,0 +1,42 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005 - 2012
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.jsword.versification;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * JUnit test of Versification classes.
+ *
+ * @see gnu.lgpl.License for license details.<br>
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class AllTests {
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.crosswire.jsword.versification");
+ // $JUnit-BEGIN$
+ suite.addTestSuite(BookNameTest.class);
+ // $JUnit-END$
+ return suite;
+ }
+}
Property changes on: trunk/jsword/src/test/java/org/crosswire/jsword/versification/AllTests.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/jsword/src/test/java/org/crosswire/jsword/versification/BookNameTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/versification/BookNameTest.java (rev 0)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/versification/BookNameTest.java 2012-01-14 14:06:50 UTC (rev 2209)
@@ -0,0 +1,156 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005 - 2012
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.jsword.versification;
+
+import junit.framework.TestCase;
+
+import org.crosswire.jsword.book.CaseType;
+
+/**
+ * JUnit test of BookName
+ *
+ * @see gnu.lgpl.License for license details.<br>
+ * The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public class BookNameTest extends TestCase {
+ public BookNameTest(String s) {
+ super(s);
+ }
+
+ private CaseType storedCase;
+ private boolean fullName;
+
+ @Override
+ protected void setUp() {
+ storedCase = BookName.getDefaultCase();
+ BookName.setCase(CaseType.SENTENCE);
+ fullName = BookName.isFullBookName();
+ BookName.setFullBookName(false);
+
+ }
+
+ @Override
+ protected void tearDown() {
+ BookName.setCase(storedCase);
+ BookName.setFullBookName(fullName);
+ }
+
+ public void testCase() {
+ BookName.setCase(CaseType.LOWER);
+ assertEquals(CaseType.LOWER, BookName.getDefaultCase());
+
+ BookName.setCase(CaseType.UPPER);
+ assertEquals(CaseType.UPPER, BookName.getDefaultCase());
+
+ BookName.setCase(CaseType.SENTENCE);
+ assertEquals(CaseType.SENTENCE, BookName.getDefaultCase());
+ }
+
+ public void testGetLongBookName() throws Exception {
+ BookName.setCase(CaseType.SENTENCE);
+ assertEquals("Genesis", BibleBook.GEN.getLongName());
+ assertEquals("Revelation of John", BibleBook.REV.getLongName());
+
+ BookName.setCase(CaseType.LOWER);
+ assertEquals("genesis", BibleBook.GEN.getLongName());
+ assertEquals("revelation of john", BibleBook.REV.getLongName());
+
+ BookName.setCase(CaseType.UPPER);
+ assertEquals("GENESIS", BibleBook.GEN.getLongName());
+ assertEquals("REVELATION OF JOHN", BibleBook.REV.getLongName());
+
+ }
+
+ public void testGetShortBookName() throws Exception {
+ BookName.setCase(CaseType.SENTENCE);
+ assertEquals("Gen", BibleBook.GEN.getShortName());
+ assertEquals("Exo", BibleBook.EXOD.getShortName());
+ assertEquals("Judg", BibleBook.JUDG.getShortName());
+ assertEquals("Mal", BibleBook.MAL.getShortName());
+ assertEquals("Mat", BibleBook.MATT.getShortName());
+ assertEquals("Phili", BibleBook.PHIL.getShortName());
+ assertEquals("Phile", BibleBook.PHLM.getShortName());
+ assertEquals("Jude", BibleBook.JUDE.getShortName());
+ assertEquals("Rev", BibleBook.REV.getShortName());
+
+ BookName.setCase(CaseType.LOWER);
+ assertEquals("gen", BibleBook.GEN.getShortName());
+ assertEquals("exo", BibleBook.EXOD.getShortName());
+ assertEquals("judg", BibleBook.JUDG.getShortName());
+ assertEquals("mal", BibleBook.MAL.getShortName());
+ assertEquals("mat", BibleBook.MATT.getShortName());
+ assertEquals("phili", BibleBook.PHIL.getShortName());
+ assertEquals("phile", BibleBook.PHLM.getShortName());
+ assertEquals("jude", BibleBook.JUDE.getShortName());
+ assertEquals("rev", BibleBook.REV.getShortName());
+
+ BookName.setCase(CaseType.UPPER);
+ assertEquals("GEN", BibleBook.GEN.getShortName());
+ assertEquals("EXO", BibleBook.EXOD.getShortName());
+ assertEquals("JUDG", BibleBook.JUDG.getShortName());
+ assertEquals("MAL", BibleBook.MAL.getShortName());
+ assertEquals("MAT", BibleBook.MATT.getShortName());
+ assertEquals("PHILI", BibleBook.PHIL.getShortName());
+ assertEquals("PHILE", BibleBook.PHLM.getShortName());
+ assertEquals("JUDE", BibleBook.JUDE.getShortName());
+ assertEquals("REV", BibleBook.REV.getShortName());
+ }
+
+ public void testGetBookJogger() throws Exception {
+ assertEquals("Gen", BibleBook.GEN.getOSIS());
+ assertEquals("Exod", BibleBook.EXOD.getOSIS());
+ assertEquals("Rev", BibleBook.REV.getOSIS());
+ }
+
+ public void testGetBookNumber() {
+ assertEquals(BibleBook.GEN, BibleBook.getBook("Genesis"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("Gene"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("Gen"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("G"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("g"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("GEN"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("genesis"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("psa"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("ps"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("pss"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("psalter"));
+ assertEquals(BibleBook.ECCL, BibleBook.getBook("ecc"));
+ assertEquals(BibleBook.ECCL, BibleBook.getBook("Qohelot"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("son"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("song"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("song of solomon"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("songofsolomon"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("ss"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("canticle"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("can"));
+ assertEquals(BibleBook.PHIL, BibleBook.getBook("phi"));
+ assertEquals(BibleBook.PHIL, BibleBook.getBook("phil"));
+ assertEquals(BibleBook.PHIL, BibleBook.getBook("phili"));
+ assertEquals(BibleBook.PHLM, BibleBook.getBook("phile"));
+ assertEquals(BibleBook.REV, BibleBook.getBook("revelations"));
+ assertEquals(BibleBook.REV, BibleBook.getBook("rev"));
+
+ assertEquals(null, BibleBook.getBook("1"));
+ }
+
+}
Property changes on: trunk/jsword/src/test/java/org/crosswire/jsword/versification/BookNameTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
More information about the jsword-svn
mailing list