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/DubArtifactVersioningTest.groovy

33 lines
1008 B
Groovy
Raw Normal View History

package com.sap.piper.versioning
import org.junit.Rule
import org.junit.Test
import org.junit.rules.RuleChain
import util.BasePiperTest
import util.JenkinsReadJsonRule
import util.JenkinsWriteJsonRule
import util.Rules
import static org.junit.Assert.assertEquals
import static org.junit.Assert.assertTrue
2019-07-03 11:27:07 +02:00
class DubArtifactVersioningTest extends BasePiperTest{
2019-07-03 11:27:07 +02:00
JenkinsReadJsonRule readJsonRule = new JenkinsReadJsonRule(this, 'test/resources/versioning/DubArtifactVersioning/')
JenkinsWriteJsonRule writeJsonRule = new JenkinsWriteJsonRule(this)
@Rule
public RuleChain ruleChain = Rules
.getCommonRules(this)
.around(readJsonRule)
.around(writeJsonRule)
@Test
void testVersioning() {
2019-07-03 11:27:07 +02:00
DubArtifactVersioning av = new DubArtifactVersioning(nullScript, [filePath: 'dub.json'])
assertEquals('1.2.3', av.getVersion())
av.setVersion('1.2.3-20180101')
assertTrue(writeJsonRule.files['dub.json'].contains('1.2.3-20180101'))
}
}