PeppolIdentifierFactory implements IIdentifierFactory { @Override public boolean isParticipantIdentifierSchemeValid (@Nullable final String sScheme) { if (!PeppolIdentifierHelper.isValidIdentifierScheme (sScheme)) return false; return RegExHelper.stringMatchesPattern (PeppolIdentifierHelper.PARTICIPANT_IDENTIFIER_SCHEME_REGEX, sScheme.toLowerCase (Locale.US)); } PeppolIdentifierFactory(); @Override boolean isDocumentTypeIdentifierSchemeMandatory(); @Nonnull @Override String getDefaultDocumentTypeIdentifierScheme(); @Override boolean isDocumentTypeIdentifierSchemeValid(@Nullable final String sScheme); @Override boolean isDocumentTypeIdentifierValueValid(@Nullable final String sValue); @Nullable @Override PeppolDocumentTypeIdentifier createDocumentTypeIdentifierWithDefaultScheme(@Nullable final String sValue); @Nullable PeppolDocumentTypeIdentifier createDocumentTypeIdentifier(@Nullable final String sScheme, @Nullable final String sValue); @Override boolean isParticipantIdentifierSchemeMandatory(); @Nonnull @Override String getDefaultParticipantIdentifierScheme(); @Override boolean isParticipantIdentifierCaseInsensitive(@Nullable final String sScheme); @Override boolean isParticipantIdentifierSchemeValid(@Nullable final String sScheme); @Override boolean isParticipantIdentifierValueValid(@Nullable final String sValue); @Nullable @Override PeppolParticipantIdentifier createParticipantIdentifierWithDefaultScheme(@Nullable final String sValue); @Nullable PeppolParticipantIdentifier createParticipantIdentifier(@Nullable final String sScheme, @Nullable final String sValue); @Nonnull @Override String getDefaultProcessIdentifierScheme(); @Override boolean isProcessIdentifierSchemeValid(@Nullable final String sScheme); @Override boolean isProcessIdentifierValueValid(@Nullable final String sValue); @Nullable @Override PeppolProcessIdentifier createProcessIdentifierWithDefaultScheme(@Nullable final String sValue); @Nullable PeppolProcessIdentifier createProcessIdentifier(@Nullable final String sScheme, @Nullable final String sValue); @Override String toString(); static final PeppolIdentifierFactory INSTANCE; }
@Test public void testIsValidParticipantIdentifierScheme () { for (final String sScheme : PARTICIPANT_SCHEME_VALID) assertTrue (PeppolIdentifierFactory.INSTANCE.isParticipantIdentifierSchemeValid (sScheme)); for (final String sScheme : PARTIFCIPANT_SCHEME_INVALID) assertFalse (PeppolIdentifierFactory.INSTANCE.isParticipantIdentifierSchemeValid (sScheme)); }