Пример #1
0
  @Before
  public void setUp() throws Exception {
    BookName.setFullBookName(false);
    // AV11N(DMS): Update test to test all V11Ns
    v11n = Versifications.instance().getVersification("KJV");

    gen00 = new Verse(v11n, BibleBook.GEN, 0, 0);
    gen10 = new Verse(v11n, BibleBook.GEN, 1, 0);
    gen11 = new Verse(v11n, BibleBook.GEN, 1, 1);
    gen11a = new Verse(v11n, BibleBook.GEN, 1, 1);
    gen11s = new Verse(v11n, BibleBook.GEN, 1, 1, "sub");
    gen12 = new Verse(v11n, BibleBook.GEN, 1, 2);
    gen20 = new Verse(v11n, BibleBook.GEN, 2, 0);
    gen21 = new Verse(v11n, BibleBook.GEN, 2, 1);
    gen22 = new Verse(v11n, BibleBook.GEN, 2, 2);
    rev11 = new Verse(v11n, BibleBook.REV, 1, 1);
    rev12 = new Verse(v11n, BibleBook.REV, 1, 2);
    rev21 = new Verse(v11n, BibleBook.REV, 2, 1);
    rev22 = new Verse(v11n, BibleBook.REV, 2, 2);
    rev99 = new Verse(v11n, BibleBook.REV, 22, 21);
    jude0 = new Verse(v11n, BibleBook.JUDE, 0, 0);
    jude1 = new Verse(v11n, BibleBook.JUDE, 1, 1);
    jude2 = new Verse(v11n, BibleBook.JUDE, 1, 2);
    jude9 = new Verse(v11n, BibleBook.JUDE, 1, 25);
    ssa00 = new Verse(v11n, BibleBook.SAM2, 0, 0);
    ssa10 = new Verse(v11n, BibleBook.SAM2, 1, 0);
    ssa11 = new Verse(v11n, BibleBook.SAM2, 1, 1);
  }
  /** @return v11n of current document */
  public Versification getVersification() {
    Book doc = getCurrentPassageDocument();

    // this should always be true
    if (doc != null && doc instanceof AbstractPassageBook) {
      return ((AbstractPassageBook) doc).getVersification();
    } else {
      // but safety first
      return Versifications.instance().getVersification(SystemKJV.V11N_NAME);
    }
  }
  /** @return */
  private BookmarkDto addTestVerse() {
    try {
      currentTestVerse = getNextTestVerse();

      BookmarkDto bookmark = new BookmarkDto();
      bookmark.setVerse(
          VerseFactory.fromString(
              Versifications.instance().getVersification("KJV"), currentTestVerse));
      BookmarkDto newDto = bookmarkControl.addBookmark(bookmark);
      return newDto;
    } catch (Exception e) {
      fail("Error in verse:" + currentTestVerse);
    }
    return null;
  }
Пример #4
0
  /**
   * Bibles like TurNTB contain merged (linked) verses which are duplicated when chapters are
   * displayed- see JS-224. This tests the deduplication code in AbstractPassageBook.
   *
   * @throws Exception
   */
  @Test
  public void testLinkedVersesNotDuplicated() throws Exception {
    Book turNTB = Books.installed().getBook("TurNTB");
    if (turNTB != null) {
      // Eph 2:4,5 are merged/linked in TurNTB
      Key eph245 =
          VerseRangeFactory.fromString(
              Versifications.instance().getVersification("KJV"), "Eph 2:4-5");
      BookData bookData = new BookData(turNTB, eph245);
      final Element osisFragment = bookData.getOsisFragment();

      final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat());
      String xml = xmlOutputter.outputString(osisFragment);

      Assert.assertTrue("Probable duplicate text", xml.length() < 300);
    }
  }
 @Override
 protected VersificationScheme[] loadSchemes() throws IOException {
   // parse header
   VersificationScheme[] result = new VersificationScheme[ALL_V11N_NAMES.length];
   for (int i = 0; i < result.length; i++) {
     EnumMap<BookID, BitSet[]> coveredBooks = new EnumMap<BookID, BitSet[]>(BookID.class);
     Versification v11n = Versifications.instance().getVersification(ALL_V11N_NAMES[i]);
     for (Iterator<BibleBook> it = v11n.getBookIterator(); it.hasNext(); ) {
       BibleBook bb = (BibleBook) it.next();
       BitSet[] chapters = new BitSet[v11n.getLastChapter(bb)];
       coveredBooks.put(BookMapping.MAPPING.get(bb), chapters);
       for (int j = 1; j <= v11n.getLastChapter(bb); j++) {
         chapters[j - 1] = new BitSet();
         chapters[j - 1].set(1, v11n.getLastVerse(bb, j) + 1);
       }
     }
     result[i] = new VersificationScheme(ALL_V11N_NAMES[i], coveredBooks);
   }
   return result;
 }
Пример #6
0
 @Test
 public void testVerseHasName() {
   Verse v = new Verse(Versifications.instance().getVersification(Versifications.DEFAULT_V11N), 5);
   assertEquals("Gen 1:2", v.getName());
 }