File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/test/java/org/nibor/autolink Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,21 @@ protected void assertNotLinked(String input) {
2424 protected abstract LinkExtractor getLinkExtractor ();
2525
2626 protected String renderExtractedLinks (String input , final String marker , final LinkType expectedLinkType ) {
27- Iterable < LinkSpan > links = getLinkExtractor (). extractLinks ( input );
28- return Autolink . renderLinks ( input , links , new LinkRenderer ( ) {
29- @ Override
30- public void render ( LinkSpan link , CharSequence text , StringBuilder sb ) {
27+ StringBuilder sb = new StringBuilder ( );
28+ for ( Span span : getLinkExtractor (). extractSpans ( input ) ) {
29+ if ( span instanceof LinkSpan ) {
30+ LinkSpan link = ( LinkSpan ) span ;
3131 if (expectedLinkType != null ) {
3232 assertEquals (expectedLinkType , link .getType ());
3333 }
3434 sb .append (marker );
35- sb .append (text , link .getBeginIndex (), link .getEndIndex ());
35+ sb .append (input , link .getBeginIndex (), link .getEndIndex ());
3636 sb .append (marker );
37+ } else {
38+ sb .append (input , span .getBeginIndex (), span .getEndIndex ());
3739 }
38- });
40+ }
41+ return sb .toString ();
3942 }
4043
4144 protected String renderExtractedSpans (String input , final String marker , final LinkType expectedLinkType ) {
You can’t perform that action at this time.
0 commit comments