}
@Test
public void getExtensionParser() throws Exception {
ChangeLogParserFactory parserFactory = ChangeLogParserFactory.getInstance();
ChangeLogParser defaultParser = parserFactory.getParser("asdf.xml", new JUnitResourceAccessor());
assertNotNull(defaultParser);
assertTrue(defaultParser instanceof XMLChangeLogSAXParser);
ChangeLogParser otherXmlParser = new XMLChangeLogSAXParser() {
@Override
public int getPriority() {
return 100;
}
};
parserFactory.register(otherXmlParser);
try {
assertTrue(otherXmlParser == parserFactory.getParser("asdf.xml", new JUnitResourceAccessor()));
assertFalse(defaultParser == parserFactory.getParser("asdf.xml", new JUnitResourceAccessor()));
} finally {
parserFactory.unregister(otherXmlParser);
}
}