i4.setAcceptable(Pattern.compile("<SYNOPSIS>"));
i4.setIdentifier("i4");
MockJavadocBlockParser parser = new MockJavadocBlockParser(i1, i2, i3, i4);
{
JavadocBlockInfo block = new JavadocBlockInfo("a", string(""), new IrLocation(0, 1));
IrDocBlock parsed = parser.parseBlock(block);
assertEquals(new IrLocation(0, 1), parsed.getLocation());
List<? extends IrDocFragment> fragments = parsed.getFragments();
assertKinds(fragments, TEXT);
assertTextEquals("i1", fragments.get(0));
}
{
JavadocBlockInfo block = new JavadocBlockInfo("b", string(""), new IrLocation(0, 1));
IrDocBlock parsed = parser.parseBlock(block);
assertEquals(new IrLocation(0, 1), parsed.getLocation());
List<? extends IrDocFragment> fragments = parsed.getFragments();
assertKinds(fragments, TEXT);
assertTextEquals("i2", fragments.get(0));
}
{
JavadocBlockInfo block = new JavadocBlockInfo("c", string(""), new IrLocation(0, 1));
IrDocBlock parsed = parser.parseBlock(block);
assertEquals(new IrLocation(0, 1), parsed.getLocation());
List<? extends IrDocFragment> fragments = parsed.getFragments();
assertKinds(fragments, TEXT);
assertTextEquals("i3", fragments.get(0));
}
{
JavadocBlockInfo block = new JavadocBlockInfo("d", string(""), new IrLocation(0, 1));
IrDocBlock parsed = parser.parseBlock(block);
assertEquals(new IrLocation(0, 1), parsed.getLocation());
List<? extends IrDocFragment> fragments = parsed.getFragments();
assertKinds(fragments, TEXT);
assertTextEquals("i3", fragments.get(0));
}
{
JavadocBlockInfo block = new JavadocBlockInfo("e", string(""), new IrLocation(0, 1));
try {
parser.parseBlock(block);
fail();
} catch (MissingJavadocBlockParserException e) {
// ok.
assertEquals("e", e.getTagName());
}
}
{
JavadocBlockInfo block = new JavadocBlockInfo(null, string(""), new IrLocation(0, 1));
IrDocBlock parsed = parser.parseBlock(block);
assertEquals(new IrLocation(0, 1), parsed.getLocation());
List<? extends IrDocFragment> fragments = parsed.getFragments();
assertKinds(fragments, TEXT);
assertTextEquals("i4", fragments.get(0));
}
}