@Test public void testParseWhenNotInWikiMode() throws Exception { ResourceReference reference = this.parser.parse("mailto:something"); Assert.assertEquals("something", reference.getReference()); Assert.assertTrue(reference.isTyped()); Assert.assertEquals(ResourceType.MAILTO, reference.getType()); Assert.assertEquals("Typed = [true] Type = [mailto] Reference = [something]", reference.toString()); reference = this.parser.parse("something"); Assert.assertEquals("something", reference.getReference()); Assert.assertFalse(reference.isTyped()); Assert.assertEquals(ResourceType.URL, reference.getType()); Assert.assertEquals("Typed = [false] Type = [url] Reference = [something]", reference.toString()); reference = this.parser.parse("doc:something"); Assert.assertEquals("doc:something", reference.getReference()); Assert.assertFalse(reference.isTyped()); Assert.assertEquals(ResourceType.URL, reference.getType()); Assert.assertEquals("Typed = [false] Type = [url] Reference = [doc:something]", reference.toString()); reference = this.parser.parse("attach:something"); Assert.assertEquals("attach:something", reference.getReference()); Assert.assertFalse(reference.isTyped()); Assert.assertEquals(ResourceType.URL, reference.getType()); Assert.assertEquals("Typed = [false] Type = [url] Reference = [attach:something]", reference.toString()); }
@Override public ResourceReference parse(String rawReference) { ResourceReference reference = this.defaultResourceReferenceParser.parse(rawReference); if (reference.getType().equals(ResourceType.UNKNOWN)) { reference = this.untypedLinkReferenceParser.parse(rawReference); } return reference; }
DefaultLinkReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { ResourceReference reference = this.defaultResourceReferenceParser.parse(rawReference); if (reference.getType().equals(ResourceType.UNKNOWN)) { reference = this.untypedLinkReferenceParser.parse(rawReference); } return reference; } }
DefaultLinkReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { ResourceReference reference = this.defaultResourceReferenceParser.parse(rawReference); if (reference.getType().equals(ResourceType.UNKNOWN)) { reference = this.untypedLinkReferenceParser.parse(rawReference); } return reference; }  }
DefaultLinkReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { ResourceReference reference = this.defaultResourceReferenceParser.parse(rawReference); if (reference.getType().equals(ResourceType.UNKNOWN)) { reference = this.untypedLinkReferenceParser.parse(rawReference); } return reference; }  @Override ResourceReference parse(String rawReference); }
DefaultLinkReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { ResourceReference reference = this.defaultResourceReferenceParser.parse(rawReference); if (reference.getType().equals(ResourceType.UNKNOWN)) { reference = this.untypedLinkReferenceParser.parse(rawReference); } return reference; }  @Override ResourceReference parse(String rawReference);  }