TwineLinkLinkRefProcessor implements LinkRefProcessor { @Override public boolean isMatch(final BasedSequence nodeChars) { if (nodeChars.length() >= TWINE_LINK_MINIMAL_LENGTH) { return nodeChars.charAt(0) == '[' && nodeChars.charAt(1) == '[' && nodeChars.endCharAt(1) == ']' && nodeChars.endCharAt(2) == ']'; } return false; }  @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 isMatch_NotMatching_ReturnsFalse() { TwineLinkLinkRefProcessor processor = new TwineLinkLinkRefProcessor(); CharSubSequence nodeChars = CharSubSequence.of("((not a link))"); boolean result = processor.isMatch(nodeChars); Assert.assertFalse(result); }
@Test public void isMatch_Matching_ReturnsTrue() { TwineLinkLinkRefProcessor processor = new TwineLinkLinkRefProcessor(); CharSubSequence nodeChars = CharSubSequence.of("[[a matching link]]"); boolean result = processor.isMatch(nodeChars); Assert.assertTrue(result); }