Class ArtifactStub

java.lang.Object
org.apache.maven.api.plugin.testing.stubs.ArtifactStub
All Implemented Interfaces:
Artifact
Direct Known Subclasses:
ProducedArtifactStub

public class ArtifactStub extends Object implements Artifact
A stub implementation of Artifact for testing purposes. Provides basic artifact information without actual artifact resolution.
Since:
4.0.0
  • Constructor Details

    • ArtifactStub

      public ArtifactStub()
    • ArtifactStub

      public ArtifactStub(String groupId, String artifactId, String classifier, String version, String extension)
  • Method Details

    • getGroupId

      @Nonnull public String getGroupId()
      Description copied from interface: Artifact
      Returns the group identifier of the artifact..
      Specified by:
      getGroupId in interface Artifact
      Returns:
      the group identifier of the artifact
      See Also:
    • setGroupId

      public void setGroupId(String groupId)
    • getArtifactId

      @Nonnull public String getArtifactId()
      Description copied from interface: Artifact
      Returns the identifier of the artifact..
      Specified by:
      getArtifactId in interface Artifact
      Returns:
      the identifier of the artifact
      See Also:
    • setArtifactId

      public void setArtifactId(String artifactId)
    • getClassifier

      @Nonnull public String getClassifier()
      Description copied from interface: Artifact
      Returns the classifier of the artifact.
      Specified by:
      getClassifier in interface Artifact
      Returns:
      the classifier or an empty string if none, never null
      See Also:
    • setClassifier

      public void setClassifier(String classifier)
    • getVersion

      @Nonnull public Version getVersion()
      Description copied from interface: Artifact
      Returns the version of the artifact.. Contrarily to ArtifactCoordinates, each Artifact is associated to a specific version instead of a range of versions. If the base version contains a meta-version such as SNAPSHOT, those keywords are replaced by, for example, the actual timestamp.
      Specified by:
      getVersion in interface Artifact
      Returns:
      the version of the artifact
      See Also:
    • setVersion

      public void setVersion(String version)
    • getBaseVersion

      public Version getBaseVersion()
      Description copied from interface: Artifact
      Returns the version or meta-version of the artifact.. A meta-version is a version suffixed with the SNAPSHOT keyword. Meta-versions are represented in a base version by their symbols (e.g., SNAPSHOT), while they are replaced by, for example, the actual timestamp in the version.
      Specified by:
      getBaseVersion in interface Artifact
      Returns:
      the version or meta-version of the artifact
    • setBaseVersion

      public void setBaseVersion(String baseVersion)
    • getExtension

      @Nonnull public String getExtension()
      Description copied from interface: Artifact
      Returns the file extension of the artifact. The dot separator is not included in the returned string.
      Specified by:
      getExtension in interface Artifact
      Returns:
      the file extension or an empty string if none, never null
      See Also:
    • setExtension

      public void setExtension(String extension)
    • isSnapshot

      public boolean isSnapshot()
      Description copied from interface: Artifact
      Determines whether this artifact uses a snapshot version.
      Specified by:
      isSnapshot in interface Artifact
      Returns:
      true if the artifact is a snapshot, false otherwise
      See Also:
    • toCoordinates

      public ArtifactCoordinates toCoordinates()
      Description copied from interface: Artifact
      Returns coordinates with the same identifiers as this artifact.. This is a shortcut for session.createArtifactCoordinates(artifact).
      Specified by:
      toCoordinates in interface Artifact
      Returns:
      coordinates with the same identifiers as this artifact
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object