ParticipantIdentifier extends AbstractQualifiedIdentifier implements Serializable { public static ParticipantIdentifier parse(String str) throws PeppolParsingException { String[] parts = str.split("::", 2); if (parts.length != 2) throw new PeppolParsingException(String.format("Unable to parse participant identifier '%s'.", str)); return of(parts[1], Scheme.of(parts[0])); } private  ParticipantIdentifier(String identifier, Scheme scheme); static ParticipantIdentifier of(String value); static ParticipantIdentifier of(String value, Scheme scheme); static ParticipantIdentifier 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 { ParticipantIdentifier participantIdentifier = ParticipantIdentifier .parse("qualifier::identifier"); Assert.assertEquals(participantIdentifier.getIdentifier(), "identifier"); Assert.assertEquals(participantIdentifier.getScheme().getIdentifier(), "qualifier"); try { ParticipantIdentifier.parse("value"); Assert.fail(); } catch (PeppolParsingException e) { } }