コード例 #1
0
  /** Test method for {@link JavadocBlockParserUtil#fetchBlockInfo(JavadocScanner)}. */
  @Test
  public void testFetchBlockInfoEmpty() {
    DefaultJavadocScanner scanner = scanner("empty-inline.txt");
    JavadocBlockInfo block = JavadocBlockParserUtil.fetchBlockInfo(scanner);
    assertEquals(JavadocTokenKind.EOF, scanner.lookahead(0).getKind());
    assertEquals("code", block.getTagName());
    assertEquals(0, block.getLocation().getStartPosition());
    assertEquals(scanner.lookahead(0).getStartPosition(), block.getLocation().getLength());

    JavadocScanner bScanner = block.getBlockScanner();
    assertEquals(JavadocTokenKind.EOF, bScanner.lookahead(0).getKind());
  }
コード例 #2
0
  /** Test method for {@link JavadocBlockParserUtil#fetchBlockInfo(JavadocScanner)}. */
  @Test
  public void testFetchBlockInfoBroken() {
    DefaultJavadocScanner scanner = scanner("broken-inline.txt");
    JavadocBlockInfo block = JavadocBlockParserUtil.fetchBlockInfo(scanner);
    assertEquals(JavadocTokenKind.EOF, scanner.lookahead(0).getKind());
    assertEquals("code", block.getTagName());
    assertEquals(0, block.getLocation().getStartPosition());
    assertEquals(scanner.lookahead(0).getStartPosition(), block.getLocation().getLength());

    JavadocScanner bScanner = block.getBlockScanner();
    IrDocText inline = JavadocBlockParserUtil.fetchText(bScanner, false, false);
    assertEquals(" Hello, world! EOF->", inline.getContent());
    assertEquals(JavadocTokenKind.EOF, bScanner.lookahead(0).getKind());
  }