TwineLinkLinkRefProcessor implements LinkRefProcessor { @Override public BasedSequence adjustInlineText(final Document document, final Node node) { TwineLink twineLink = (TwineLink) node; return twineLink.getText().ifNull(twineLink.getPassage()); }  @Override boolean getWantExclamationPrefix(); @Override int getBracketNestingLevel(); @Override boolean isMatch(final BasedSequence nodeChars); @Override Node createNode(final BasedSequence nodeChars); @Override BasedSequence adjustInlineText(final Document document, final Node node); @Override boolean allowDelimiters(final BasedSequence chars, final Document document, final Node node); @Override void updateNodeElements(final Document document, final Node node);  }
@Test public void adjustInlineText_ReturnsTextIfNotNull() { TwineLinkLinkRefProcessor processor = new TwineLinkLinkRefProcessor(); TwineLink twineLink = new TwineLink(CharSubSequence.of("[[my text->a matching link]]")); BasedSequence basedSequence = processor.adjustInlineText(null, twineLink); Assert.assertEquals("my text", basedSequence.unescape()); }
@Test public void adjustInlineText_ReturnsPassageIfTextIsNull() { TwineLinkLinkRefProcessor processor = new TwineLinkLinkRefProcessor(); TwineLink twineLink = new TwineLink(CharSubSequence.of("[[a matching link]]")); BasedSequence basedSequence = processor.adjustInlineText(null, twineLink); assertEquals("a matching link", basedSequence.unescape()); }