ImmutableFeatureDefinitionIdentifier implements DefinitionIdentifier { public static ImmutableFeatureDefinitionIdentifier ofParsed(final CharSequence featureDefinitionIdentifier) { checkNotNull(featureDefinitionIdentifier, "CharSequence-representation of the identifier"); if (featureDefinitionIdentifier instanceof ImmutableFeatureDefinitionIdentifier) { return (ImmutableFeatureDefinitionIdentifier) featureDefinitionIdentifier; } return new ImmutableFeatureDefinitionIdentifier( ImmutableDefinitionIdentifier.ofParsed(featureDefinitionIdentifier) ); } private  ImmutableFeatureDefinitionIdentifier(final DefinitionIdentifier delegate); private  ImmutableFeatureDefinitionIdentifier(final CharSequence theNamespace, final CharSequence theName,
            final CharSequence theVersion); static ImmutableFeatureDefinitionIdentifier getInstance(final CharSequence namespace,
            final CharSequence name, final CharSequence version); static ImmutableFeatureDefinitionIdentifier ofParsed(final CharSequence featureDefinitionIdentifier); @Override String getNamespace(); @Override String getName(); @Override String getVersion(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int length(); @Override char charAt(final int index); @Override CharSequence subSequence(final int start, final int end); @Override String toString();  }
@Test public void tryToParseNullIdentifierString() { assertThatNullPointerException() .isThrownBy(() -> ImmutableFeatureDefinitionIdentifier.ofParsed(null)) .withMessage("The %s must not be null!", "CharSequence-representation of the identifier") .withNoCause(); }
@Test public void tryToParseEmptyIdentifierString() { assertThatExceptionOfType(DefinitionIdentifierInvalidException.class) .isThrownBy(() -> ImmutableFeatureDefinitionIdentifier.ofParsed("")) .withMessage("Definition identifier <> is invalid!") .withNoCause(); }
@Test public void tryToParseIdentifierStringWithEmptyNameSegment() { final String invalidString = NAMESPACE + "::" + VERSION; assertThatExceptionOfType(DefinitionIdentifierInvalidException.class) .isThrownBy(() -> ImmutableFeatureDefinitionIdentifier.ofParsed(invalidString)) .withMessage("Definition identifier <%s> is invalid!", invalidString) .withNoCause(); }
@Test public void tryToParseIdentifierStringWithIllegalChar() { final String invalidString = "org/eclipse/ditto" + ":" + NAME + ":" + VERSION; assertThatExceptionOfType(DefinitionIdentifierInvalidException.class) .isThrownBy(() -> ImmutableFeatureDefinitionIdentifier.ofParsed(invalidString)) .withMessage("Definition identifier <%s> is invalid!", invalidString) .withNoCause(); }