### Question:
FlexmarkDoxiaLinkResolver implements LinkResolver { @Override public ResolvedLink resolveLink( Node node, LinkResolverContext context, ResolvedLink link ) { if ( link.getLinkType() == LinkType.LINK ) { Matcher matcher = this.pattern.matcher( link.getUrl() ); if ( matcher.matches() ) { return link.withStatus( LinkStatus.VALID ).withUrl( matcher.replaceAll( "$1.html$2" ) ); } } return link; } FlexmarkDoxiaLinkResolver( LinkResolverContext context ); @Override ResolvedLink resolveLink( Node node, LinkResolverContext context, ResolvedLink link );  }### Answer:
@Test public void testResolveLink() { FlexmarkDoxiaLinkResolver flexmarkDoxiaLinkResolver = new FlexmarkDoxiaLinkResolver( null ); checkLinkRewritten( flexmarkDoxiaLinkResolver, "doc.md", "doc.html" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, "doc.markdown", "doc.html" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, "doc.md#anchor", "doc.html#anchor" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, "doc.markdown#anchor", "doc.html#anchor" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, ":doc.md", ":doc.html" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, ":doc.markdown", ":doc.html" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, ":doc.md#anchor", ":doc.html#anchor" ); checkLinkRewritten( flexmarkDoxiaLinkResolver, ":doc.markdown#anchor", ":doc.html#anchor" ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "doc.md", LinkType.LINK_REF ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "doc.md", LinkType.IMAGE ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "doc.md", LinkType.IMAGE_REF ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "doc.markdown", LinkType.LINK_REF ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "doc.markdown", LinkType.IMAGE ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "doc.markdown", LinkType.IMAGE_REF ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "http: checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "https: checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "ftp: checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "http: checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "https: checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "ftp: checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.md.badformat", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.markdown.badformat", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.md#bad#format", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.md#bad.format", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.md.bad#format", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.markdown#bad#format", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.markdown#bad.format", LinkType.LINK ); checkLinkLeftUnchanged( flexmarkDoxiaLinkResolver, "docs.markdown.bad#format", LinkType.LINK ); }