@Test public void withClassifier() { DependencyAtom dependencyAtom = new DependencyAtom("net.ocheyedan", "ply", "1.0"); DependencyAtom transformed = dependencyAtom.withClassifier(null); assertSame(dependencyAtom, transformed); transformed = dependencyAtom.withClassifier(""); assertSame(dependencyAtom, transformed); try { dependencyAtom.withClassifier(" "); fail("Expected an IllegalArgumentException as DependencyAtom objects cannot contain whitespace."); } catch (IllegalArgumentException iae) { } try { dependencyAtom.withClassifier("test\ning"); fail("Expected an IllegalArgumentException as DependencyAtom objects cannot contain whitespace."); } catch (IllegalArgumentException iae) { } try { dependencyAtom.withClassifier("test\ting"); fail("Expected an IllegalArgumentException as DependencyAtom objects cannot contain whitespace."); } catch (IllegalArgumentException iae) { } try { dependencyAtom.withClassifier("test\ring"); fail("Expected an IllegalArgumentException as DependencyAtom objects cannot contain whitespace."); } catch (IllegalArgumentException iae) { } transformed = dependencyAtom.withClassifier("sources"); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertEquals("ply-1.0-sources.jar", transformed.artifactName); transformed = dependencyAtom.with("zip"); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertEquals("ply-1.0.zip", transformed.artifactName); transformed = transformed.withClassifier("sources"); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertEquals("ply-1.0-sources.zip", transformed.artifactName); }
public DependencyAtom withClassifier(String classifier) { if ((classifier == null) || classifier.isEmpty()) { return this; } Matcher whiteSpaceMatcher = WHITE_SPACE_REGEX.matcher(classifier); if (whiteSpaceMatcher.find()) { throw new IllegalArgumentException("DependencyAtom objects cannot contain whitespace."); } return new DependencyAtom(namespace, name, version, composeArtifact(name, version, classifier, getSyntheticPackaging()), transientDep); }
DependencyAtom { public DependencyAtom withClassifier(String classifier) { if ((classifier == null) || classifier.isEmpty()) { return this; } Matcher whiteSpaceMatcher = WHITE_SPACE_REGEX.matcher(classifier); if (whiteSpaceMatcher.find()) { throw new IllegalArgumentException("DependencyAtom objects cannot contain whitespace."); } return new DependencyAtom(namespace, name, version, composeArtifact(name, version, classifier, getSyntheticPackaging()), transientDep); } }
DependencyAtom { public DependencyAtom withClassifier(String classifier) { if ((classifier == null) || classifier.isEmpty()) { return this; } Matcher whiteSpaceMatcher = WHITE_SPACE_REGEX.matcher(classifier); if (whiteSpaceMatcher.find()) { throw new IllegalArgumentException("DependencyAtom objects cannot contain whitespace."); } return new DependencyAtom(namespace, name, version, composeArtifact(name, version, classifier, getSyntheticPackaging()), transientDep); } DependencyAtom(String namespace, String name, String version, String artifactName, boolean transientDep);  DependencyAtom(String namespace, String name, String version, String artifactName);  DependencyAtom(String namespace, String name, String version, boolean transientDep);  DependencyAtom(String namespace, String name, String version); }
DependencyAtom { public DependencyAtom withClassifier(String classifier) { if ((classifier == null) || classifier.isEmpty()) { return this; } Matcher whiteSpaceMatcher = WHITE_SPACE_REGEX.matcher(classifier); if (whiteSpaceMatcher.find()) { throw new IllegalArgumentException("DependencyAtom objects cannot contain whitespace."); } return new DependencyAtom(namespace, name, version, composeArtifact(name, version, classifier, getSyntheticPackaging()), transientDep); } DependencyAtom(String namespace, String name, String version, String artifactName, boolean transientDep);  DependencyAtom(String namespace, String name, String version, String artifactName);  DependencyAtom(String namespace, String name, String version, boolean transientDep);  DependencyAtom(String namespace, String name, String version); String getPropertyName(); String getPropertyValue(); String getPropertyValueWithoutTransient(); String getResolvedPropertyValue(); String getArtifactName(); DependencyAtom with(String packaging); DependencyAtom withClassifier(String classifier); DependencyAtom withoutClassifier(); String getClassifier(); String getSyntheticPackaging(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static boolean isTransient(String atom); static String stripTransient(String atom); static DependencyAtom parse(String atom, AtomicReference<String> error); }
DependencyAtom { public DependencyAtom withClassifier(String classifier) { if ((classifier == null) || classifier.isEmpty()) { return this; } Matcher whiteSpaceMatcher = WHITE_SPACE_REGEX.matcher(classifier); if (whiteSpaceMatcher.find()) { throw new IllegalArgumentException("DependencyAtom objects cannot contain whitespace."); } return new DependencyAtom(namespace, name, version, composeArtifact(name, version, classifier, getSyntheticPackaging()), transientDep); } DependencyAtom(String namespace, String name, String version, String artifactName, boolean transientDep);  DependencyAtom(String namespace, String name, String version, String artifactName);  DependencyAtom(String namespace, String name, String version, boolean transientDep);  DependencyAtom(String namespace, String name, String version); String getPropertyName(); String getPropertyValue(); String getPropertyValueWithoutTransient(); String getResolvedPropertyValue(); String getArtifactName(); DependencyAtom with(String packaging); DependencyAtom withClassifier(String classifier); DependencyAtom withoutClassifier(); String getClassifier(); String getSyntheticPackaging(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static boolean isTransient(String atom); static String stripTransient(String atom); static DependencyAtom parse(String atom, AtomicReference<String> error); static final String DEFAULT_PACKAGING; final String namespace; final String name; final String version; final String artifactName; final boolean transientDep; }