DocumentTypeIdentifier extends AbstractQualifiedIdentifier implements Serializable { public static DocumentTypeIdentifier parse(String str) throws PeppolParsingException { String[] parts = str.split("::", 2); if (parts.length != 2) throw new PeppolParsingException(String.format("Unable to parse document type identifier '%s'.", str)); return of(parts[1], Scheme.of(parts[0])); } protected  DocumentTypeIdentifier(String value, Scheme scheme); static DocumentTypeIdentifier of(String identifier); static DocumentTypeIdentifier of(String identifier, Scheme scheme); static DocumentTypeIdentifier parse(String str); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Scheme DEFAULT_SCHEME; }
@Test public void simpleParse() throws Exception { DocumentTypeIdentifier documentTypeIdentifier = DocumentTypeIdentifier .parse("qualifier::identifier"); Assert.assertEquals(documentTypeIdentifier.getIdentifier(), "identifier"); Assert.assertEquals(documentTypeIdentifier.getScheme().getIdentifier(), "qualifier"); try { DocumentTypeIdentifier.parse("value"); Assert.fail(); } catch (PeppolParsingException e) { } }