Exemple #1
0
 @Test
 public void testGetNameVerse() throws Exception {
   assertEquals(VerseFactory.fromString(v11n, "Gen 1:2").getName(gen11), "2");
   assertEquals(VerseFactory.fromString(v11n, "Gen 2:1").getName(gen11), "2:1");
   assertEquals(VerseFactory.fromString(v11n, "Gen 2:1").getName(jude9), "Gen 2:1");
   assertEquals(VerseFactory.fromString(v11n, "Gen 2:1").getName(null), "Gen 2:1");
 }
Exemple #2
0
 @Test
 public void testGetName() throws Exception {
   assertEquals(VerseFactory.fromString(v11n, "Genesis 1 1").getName(), "Gen 1:1");
   assertEquals(VerseFactory.fromString(v11n, "Gen 1 1").getName(), "Gen 1:1");
   assertEquals(VerseFactory.fromString(v11n, "Genesis 1:1").getName(), "Gen 1:1");
   assertEquals(VerseFactory.fromString(v11n, "Gen 1 1").getName(), "Gen 1:1");
   assertEquals(VerseFactory.fromString(v11n, "ge 1 1").getName(), "Gen 1:1");
   assertEquals(VerseFactory.fromString(v11n, "ge").getName(), "Gen 0:0");
   assertEquals(VerseFactory.fromString(v11n, "Ge:1:1").getName(), "Gen 1:1");
   assertEquals(VerseFactory.fromString(v11n, "Jude 1").getName(), "Jude 1");
   assertEquals(VerseFactory.fromString(v11n, "Jude").getName(), "Jude 0");
   assertEquals(VerseFactory.fromString(v11n, "Jude 1:1").getName(), "Jude 1");
 }
Exemple #3
0
 @Test
 public void testNewViaString() throws Exception {
   assertEquals(gen11s, VerseFactory.fromString(v11n, "Gen.1.1!sub"));
   assertEquals(gen11, Verse.DEFAULT);
   assertEquals(gen11, VerseFactory.fromString(v11n, "Genesis 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "Gen 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "Ge 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "genesis 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "genesi 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "GENESIS 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "GENESI 1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge 1 1"));
   assertEquals(gen10, VerseFactory.fromString(v11n, "ge 1"));
   assertEquals(gen00, VerseFactory.fromString(v11n, "ge"));
   assertEquals(gen00, VerseFactory.fromString(v11n, "gen"));
   assertEquals(rev99, VerseFactory.fromString(v11n, "rev 22 21"));
   assertEquals(rev99, VerseFactory.fromString(v11n, "REVE 22 21"));
   assertEquals(rev99, VerseFactory.fromString(v11n, "REVELATIONS 22 21"));
   assertEquals(gen20, VerseFactory.fromString(v11n, "ge 2"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge.1.1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge 1.1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge.1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge.1:1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge:1:1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "ge:1 1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, " ge 1 1 "));
   assertEquals(gen10, VerseFactory.fromString(v11n, "gen1"));
   assertEquals(gen10, VerseFactory.fromString(v11n, "GEN1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "GENESIS1:1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, "GE1    1"));
   assertEquals(gen11, VerseFactory.fromString(v11n, " GEN  1  1  "));
   assertEquals(gen11, VerseFactory.fromString(v11n, " gen 1 1 "));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2Sa 1:1"));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2Sa 1 1"));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2Sa1 1"));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2 Sa 1 1"));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2 Sa1 1"));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2Sa1:1"));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "2 Sa 1 1"));
   assertEquals(ssa10, VerseFactory.fromString(v11n, "  2  Sa  1  "));
   assertEquals(ssa00, VerseFactory.fromString(v11n, "  2  Sa  "));
   assertEquals(ssa10, VerseFactory.fromString(v11n, "  2  Sa1  "));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "  2  Sa1  1  "));
   assertEquals(ssa11, VerseFactory.fromString(v11n, "  2 : Sa1  1  "));
   assertEquals(rev99, VerseFactory.fromString(v11n, "Rev 22:$"));
   assertEquals(rev99, VerseFactory.fromString(v11n, " Rev 22 ff "));
   assertEquals(rev99, VerseFactory.fromString(v11n, "  Rev  22  ff  "));
   assertEquals(rev99, VerseFactory.fromString(v11n, "  Rev  22  $  "));
   assertEquals(jude0, VerseFactory.fromString(v11n, "Jude"));
   assertEquals(jude9, VerseFactory.fromString(v11n, "Jude $"));
   assertEquals(jude9, VerseFactory.fromString(v11n, " Jude  $ "));
   assertEquals(jude9, VerseFactory.fromString(v11n, "Jude ff"));
   assertEquals(jude9, VerseFactory.fromString(v11n, "  Jude  ff  "));
   assertEquals(VerseFactory.fromString(v11n, "Deu 1:1"), VerseFactory.fromString(v11n, "Dt 1:1"));
   assertEquals(VerseFactory.fromString(v11n, "Mat 1:1"), VerseFactory.fromString(v11n, "Mt 1:1"));
   try {
     VerseFactory.fromString(v11n, "gen 1 1 1");
     fail();
   } catch (NoSuchVerseException ex) {
   }
   try {
     VerseFactory.fromString(v11n, "gen.1.1.1");
     fail();
   } catch (NoSuchVerseException ex) {
   }
   try {
     VerseFactory.fromString(v11n, "gen.1.1:1");
     fail();
   } catch (NoSuchVerseException ex) {
   }
   try {
     VerseFactory.fromString(v11n, "gen 1 1 1");
     fail();
   } catch (NoSuchVerseException ex) {
   }
   try {
     VerseFactory.fromString(v11n, "gen 1 1 1");
     fail();
   } catch (NoSuchVerseException ex) {
   }
   try {
     VerseFactory.fromString(v11n, "gen 1 1 1");
     fail();
   } catch (NoSuchVerseException ex) {
   }
   try {
     VerseFactory.fromString(v11n, null);
     fail();
   } catch (NullPointerException ex) {
   } catch (NoSuchKeyException ex) {
   }
   assertEquals(jude1, VerseFactory.fromString(v11n, "jude 1"));
   assertEquals(jude2, VerseFactory.fromString(v11n, "jude 2"));
   assertEquals(jude9, VerseFactory.fromString(v11n, "jude 25"));
 }
Exemple #4
0
  @Test
  public void testIsStartEndOfChapterBook() throws Exception {
    assertTrue(v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen 1:1")));
    assertTrue(!v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen 1:10")));
    assertTrue(!v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen 1:$")));
    assertTrue(v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen 10:0")));
    assertTrue(!v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen 10:10")));
    assertTrue(!v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen 10:$")));
    assertTrue(v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen $:0")));
    assertTrue(!v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen $:10")));
    assertTrue(!v11n.isStartOfChapter(VerseFactory.fromString(v11n, "Gen $:$")));
    assertTrue(!v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen 1:1")));
    assertTrue(!v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen 1:10")));
    assertTrue(v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen 1:$")));
    assertTrue(!v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen 10:1")));
    assertTrue(!v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen 10:10")));
    assertTrue(v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen 10:$")));
    assertTrue(!v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen $:1")));
    assertTrue(!v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen $:10")));
    assertTrue(v11n.isEndOfChapter(VerseFactory.fromString(v11n, "Gen $:$")));
    assertTrue(v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen 0:0")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen 1:10")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen 1:$")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen 10:1")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen 10:10")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen 10:$")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen $:1")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen $:10")));
    assertTrue(!v11n.isStartOfBook(VerseFactory.fromString(v11n, "Gen $:$")));

    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen 1:1")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen 1:10")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen 1:$")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen 10:1")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen 10:10")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen 10:$")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen $:1")));
    assertTrue(!v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen $:10")));
    assertTrue(v11n.isEndOfBook(VerseFactory.fromString(v11n, "Gen $:$")));
  }