コード例 #1
0
  /** Tests override of default skipping of number kanji */
  @Test
  public void testNumbers() {
    String testString = "一億三千";

    Reading[] expectedReadings =
        new Reading[] {
          new Reading(1, 1, "おく"),
        };

    OverrideFilter overrideFilter = new OverrideFilter();

    ReadingProcessor processor = getReadingProcessor();
    processor.addFilter(0, new NumberFilter());
    processor.addFilter(1, overrideFilter);

    processor.setText(testString);
    overrideFilter.setVisible(1, true);

    List<Reading> readings = processor.getDisplayReadings();

    compareReadings(expectedReadings, readings);
  }
コード例 #2
0
  /** Tests override of default visibility */
  @Test
  public void testHide() {
    String testString = "3週間寒さが続いた";

    Reading[] expectedReadings =
        new Reading[] {
          new Reading(1, 2, "しゅうかん"), new Reading(6, 1, "つづ"),
        };

    OverrideFilter overrideFilter = new OverrideFilter();

    ReadingProcessor processor = getReadingProcessor();
    processor.addFilter(0, new NumberFilter());
    processor.addFilter(1, overrideFilter);

    processor.setText(testString);
    overrideFilter.setVisible(3, false);

    List<Reading> readings = processor.getDisplayReadings();

    compareReadings(expectedReadings, readings);
  }