SimpleIdentifierFactory implements IIdentifierFactory { @Nullable public SimpleProcessIdentifier createProcessIdentifier (@Nullable final String sScheme, @Nullable final String sValue) { final String sRealValue = isProcessIdentifierCaseInsensitive (sScheme) ? getUnifiedValue (sValue) : sValue; return new SimpleProcessIdentifier (nullNotEmpty (sScheme), nullNotEmpty (sRealValue)); } SimpleIdentifierFactory(); @Override boolean isProcessIdentifierSchemeMandatory(); @Nullable SimpleDocumentTypeIdentifier createDocumentTypeIdentifier(@Nullable final String sScheme, @Nullable final String sValue); @Nullable SimpleParticipantIdentifier createParticipantIdentifier(@Nullable final String sScheme, @Nullable final String sValue); @Nullable SimpleProcessIdentifier createProcessIdentifier(@Nullable final String sScheme, @Nullable final String sValue); @Override String toString(); static final SimpleIdentifierFactory INSTANCE; }
@Test public void testProcessIDCreation () { final SimpleIdentifierFactory aIF = SimpleIdentifierFactory.INSTANCE; assertNotNull (aIF.createProcessIdentifier (null, null)); assertNotNull (aIF.createProcessIdentifier (null, "any")); assertNotNull (aIF.createProcessIdentifier (null, "")); assertNotNull (aIF.createProcessIdentifier ("", "")); assertNotNull (aIF.createProcessIdentifier ("bla::#: }
@Test public void testProcessIDCaseInsensitive () { final SimpleIdentifierFactory aIF = SimpleIdentifierFactory.INSTANCE; final String sScheme = CBDXR1Identifier.DEFAULT_PROCESS_IDENTIFIER_SCHEME; final IProcessIdentifier aID1 = aIF.createProcessIdentifier (sScheme, "abc"); assertEquals (sScheme, aID1.getScheme ()); assertEquals ("abc", aID1.getValue ()); final IProcessIdentifier aID2 = aIF.createProcessIdentifier (sScheme, "ABC"); assertEquals (sScheme, aID2.getScheme ()); assertEquals ("ABC", aID2.getValue ()); assertFalse (aID1.hasSameContent (aID2)); }
@Test public void testProcessIDCaseSensitive () { final SimpleIdentifierFactory aIF = SimpleIdentifierFactory.INSTANCE; final String sScheme = "cs-docid-qns"; final IProcessIdentifier aID1 = aIF.createProcessIdentifier (sScheme, "abc"); assertEquals (sScheme, aID1.getScheme ()); assertEquals ("abc", aID1.getValue ()); final IProcessIdentifier aID2 = aIF.createProcessIdentifier (sScheme, "ABC"); assertEquals (sScheme, aID2.getScheme ()); assertEquals ("ABC", aID2.getValue ()); assertFalse (aID1.hasSameContent (aID2)); }