@Test public void valueOfWhenInvalid() { Throwable exception = assertThrows(ParseException.class, () -> { Syntax.valueOf("invalid"); }); assertEquals("Invalid Syntax format [invalid]", exception.getMessage()); }
public static Syntax valueOf(String syntaxIdAsString) throws ParseException { if (syntaxIdAsString == null) { throw new ParseException("The passed Syntax cannot be NULL"); } Matcher matcher = SYNTAX_PATTERN.matcher(syntaxIdAsString); if (!matcher.matches()) { throw new ParseException(String.format("Invalid Syntax format [%s]", syntaxIdAsString)); } String syntaxId = matcher.group(1); String version = matcher.group(2); SyntaxType syntaxType = SyntaxType.getSyntaxTypes().get(syntaxId); if (syntaxType == null) { syntaxType = new SyntaxType(syntaxId, syntaxId); } return new Syntax(syntaxType, version); }
Syntax implements Comparable<Syntax> { public static Syntax valueOf(String syntaxIdAsString) throws ParseException { if (syntaxIdAsString == null) { throw new ParseException("The passed Syntax cannot be NULL"); } Matcher matcher = SYNTAX_PATTERN.matcher(syntaxIdAsString); if (!matcher.matches()) { throw new ParseException(String.format("Invalid Syntax format [%s]", syntaxIdAsString)); } String syntaxId = matcher.group(1); String version = matcher.group(2); SyntaxType syntaxType = SyntaxType.getSyntaxTypes().get(syntaxId); if (syntaxType == null) { syntaxType = new SyntaxType(syntaxId, syntaxId); } return new Syntax(syntaxType, version); } }
Syntax implements Comparable<Syntax> { public static Syntax valueOf(String syntaxIdAsString) throws ParseException { if (syntaxIdAsString == null) { throw new ParseException("The passed Syntax cannot be NULL"); } Matcher matcher = SYNTAX_PATTERN.matcher(syntaxIdAsString); if (!matcher.matches()) { throw new ParseException(String.format("Invalid Syntax format [%s]", syntaxIdAsString)); } String syntaxId = matcher.group(1); String version = matcher.group(2); SyntaxType syntaxType = SyntaxType.getSyntaxTypes().get(syntaxId); if (syntaxType == null) { syntaxType = new SyntaxType(syntaxId, syntaxId); } return new Syntax(syntaxType, version); } Syntax(SyntaxType type, String version);  Syntax(SyntaxType type, String version, String qualifier); }
Syntax implements Comparable<Syntax> { public static Syntax valueOf(String syntaxIdAsString) throws ParseException { if (syntaxIdAsString == null) { throw new ParseException("The passed Syntax cannot be NULL"); } Matcher matcher = SYNTAX_PATTERN.matcher(syntaxIdAsString); if (!matcher.matches()) { throw new ParseException(String.format("Invalid Syntax format [%s]", syntaxIdAsString)); } String syntaxId = matcher.group(1); String version = matcher.group(2); SyntaxType syntaxType = SyntaxType.getSyntaxTypes().get(syntaxId); if (syntaxType == null) { syntaxType = new SyntaxType(syntaxId, syntaxId); } return new Syntax(syntaxType, version); } Syntax(SyntaxType type, String version);  Syntax(SyntaxType type, String version, String qualifier); static Syntax valueOf(String syntaxIdAsString); SyntaxType getType(); String getVersion(); String getQualifier(); String toIdString(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); @Override int compareTo(Syntax syntax); }
Syntax implements Comparable<Syntax> { public static Syntax valueOf(String syntaxIdAsString) throws ParseException { if (syntaxIdAsString == null) { throw new ParseException("The passed Syntax cannot be NULL"); } Matcher matcher = SYNTAX_PATTERN.matcher(syntaxIdAsString); if (!matcher.matches()) { throw new ParseException(String.format("Invalid Syntax format [%s]", syntaxIdAsString)); } String syntaxId = matcher.group(1); String version = matcher.group(2); SyntaxType syntaxType = SyntaxType.getSyntaxTypes().get(syntaxId); if (syntaxType == null) { syntaxType = new SyntaxType(syntaxId, syntaxId); } return new Syntax(syntaxType, version); } Syntax(SyntaxType type, String version);  Syntax(SyntaxType type, String version, String qualifier); static Syntax valueOf(String syntaxIdAsString); SyntaxType getType(); String getVersion(); String getQualifier(); String toIdString(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); @Override int compareTo(Syntax syntax); static final Syntax HTML_5_0; static final Syntax XHTML_1_0; static final Syntax HTML_4_01; @Deprecated
    static final Syntax XWIKI_1_0; static final Syntax XWIKI_2_0; static final Syntax XWIKI_2_1; static final Syntax PLAIN_1_0; static final Syntax EVENT_1_0; static final Syntax TEX_1_0; static final Syntax CREOLE_1_0; static final Syntax JSPWIKI_1_0; static final Syntax MEDIAWIKI_1_0; static final Syntax MEDIAWIKI_1_6; static final Syntax DOKUWIKI_1_0; static final Syntax TWIKI_1_0; static final Syntax DOCBOOK_4_4; static final Syntax CONFLUENCE_1_0; static final Syntax CONFLUENCEXHTML_1_0; static final Syntax XDOMXML_CURRENT; static final Syntax XDOMXML_1_0; static final Syntax MARKDOWN_1_0; static final Syntax MARKDOWN_1_1; static final Syntax APT_1_0; static final Syntax ANNOTATED_XHTML_1_0; static final Syntax ANNOTATED_HTML_5_0; }