コード例 #1
0
 /**
  * Test method for {@link JavadocBlockParserUtil#setLocation(IrDocElement, IrLocation,
  * IrLocation)}.
  */
 @Test
 public void testSetLocationLocation() {
   {
     IrDocElement elem = new IrDocText("text");
     IrLocation start = new IrLocation(10, 2);
     IrLocation stop = new IrLocation(20, 2);
     JavadocBlockParserUtil.setLocation(elem, start, stop);
     assertEquals(10, elem.getLocation().getStartPosition());
     assertEquals(12, elem.getLocation().getLength());
   }
   {
     IrDocElement elem = new IrDocText("text");
     IrLocation start = new IrLocation(10, 2);
     JavadocBlockParserUtil.setLocation(elem, start, start);
     assertEquals(10, elem.getLocation().getStartPosition());
     assertEquals(2, elem.getLocation().getLength());
   }
   {
     IrDocElement elem = new IrDocText("text");
     IrLocation fragment = new IrLocation(10, 2);
     JavadocBlockParserUtil.setLocation(elem, null, fragment);
     assertNull(elem.getLocation());
   }
   {
     IrDocElement elem = new IrDocText("text");
     IrLocation fragment = new IrLocation(10, 2);
     JavadocBlockParserUtil.setLocation(elem, fragment, null);
     assertNull(elem.getLocation());
   }
 }
コード例 #2
0
 /**
  * Test method for {@link JavadocBlockParserUtil#setLocation(IrDocElement, JavadocToken,
  * JavadocToken)}.
  */
 @Test
 public void testSetLocationToken() {
   {
     IrDocElement elem = new IrDocText("text");
     JavadocToken start = new JavadocToken(JavadocTokenKind.IDENTIFIER, "id", 10);
     JavadocToken stop = new JavadocToken(JavadocTokenKind.IDENTIFIER, "id", 20);
     JavadocBlockParserUtil.setLocation(elem, start, stop);
     assertEquals(10, elem.getLocation().getStartPosition());
     assertEquals(12, elem.getLocation().getLength());
   }
   {
     IrDocElement elem = new IrDocText("text");
     JavadocToken start = new JavadocToken(JavadocTokenKind.IDENTIFIER, "id", 10);
     JavadocBlockParserUtil.setLocation(elem, start, start);
     assertEquals(10, elem.getLocation().getStartPosition());
     assertEquals(2, elem.getLocation().getLength());
   }
 }