github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/test/groovy/com/sap/piper/versioning/ArtifactVersioningTest.groovy (about)

     1  package com.sap.piper.versioning
     2  
     3  import org.junit.Before
     4  import org.junit.Rule
     5  import org.junit.Test
     6  import org.junit.rules.ExpectedException
     7  
     8  import static org.junit.Assert.assertTrue
     9  import static org.junit.Assert.assertEquals
    10  
    11  class ArtifactVersioningTest {
    12  
    13      @Rule
    14      public ExpectedException thrown = ExpectedException.none()
    15  
    16      @Test
    17      void testInstatiateFactoryMethod() {
    18          def versionObj = ArtifactVersioning.getArtifactVersioning( 'maven', this, [:])
    19          assertTrue(versionObj instanceof MavenArtifactVersioning)
    20      }
    21  
    22      @Test
    23      void testInstatiateFactoryMethodWithInvalidToolId() {
    24          thrown.expect(IllegalArgumentException)
    25          thrown.expectMessage('No versioning implementation for buildTool: invalid available.')
    26          ArtifactVersioning.getArtifactVersioning('invalid', this, [:])
    27      }
    28  }