コード例 #1
0
  /** Test of getWord method, of class PdfWord. */
  @Test
  public void testGetWord() {
    instance.setWord("test word");
    assertEquals(instance.getWord(), "test word");

    instance.setWord("");
    assertEquals(instance.getWord(), "");
  }
コード例 #2
0
  /** Test of addCharacter method, of class PdfWord. */
  @Test
  public void testAddCharacter() throws IOException {
    instance.addCharacter(char2);
    ArrayList<PdfWordPosition> posTmp = instance.getPositions();

    assertEquals(instance.getWord(), "ab");
    assertEquals(posTmp.size(), 1);
    assertEquals(posTmp.get(0).getStart(), char1);
    assertEquals(posTmp.get(0).getEnd(), char2);

    PdfWord instanceTmp = new PdfWord(char1);
    PdfCharacter char3 = this.createPdfCharacter("-");
    instanceTmp.addCharacter(char3);
    assertEquals(instanceTmp.getWord(), "a");
    instanceTmp.addCharacter(char2);
    assertEquals(instanceTmp.getWord(), "ab");
  }
コード例 #3
0
  /** Test of toJson method, of class PdfWord. */
  @Test
  public void testConstructor() {
    PdfWord instanceTmp = new PdfWord(char1);
    ArrayList<PdfWordPosition> posTmp = instanceTmp.getPositions();

    assertEquals(instanceTmp.getWord(), "a");
    assertEquals(posTmp.size(), 1);
    assertEquals(posTmp.get(0).getStart(), char1);
    assertEquals(posTmp.get(0).getEnd(), char1);
  }