1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/test/groovy/com/sap/piper/versioning/PipArtifactVersioningTest.groovy
2019-01-23 14:54:52 +01:00

32 lines
965 B
Groovy

package com.sap.piper.versioning
import org.junit.Rule
import org.junit.Test
import org.junit.rules.RuleChain
import util.BasePiperTest
import util.JenkinsReadFileRule
import util.JenkinsWriteFileRule
import util.Rules
import static org.junit.Assert.assertEquals
class PipArtifactVersioningTest extends BasePiperTest{
JenkinsReadFileRule readFileRule = new JenkinsReadFileRule(this, 'test/resources/versioning/PipArtifactVersioning/')
JenkinsWriteFileRule writeFileRule = new JenkinsWriteFileRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(readFileRule)
.around(writeFileRule)
@Test
void testVersioning() {
PipArtifactVersioning av = new PipArtifactVersioning(nullScript, [filePath: 'version.txt'])
assertEquals('1.2.3', av.getVersion())
av.setVersion('1.2.3-20180101')
assertEquals('1.2.3-20180101', writeFileRule.files['version.txt'])
}
}