2018-08-08 22:21:26 +02:00
|
|
|
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{
|
2018-08-08 22:21:26 +02:00
|
|
|
|
2019-07-03 11:27:07 +02:00
|
|
|
JenkinsReadJsonRule readJsonRule = new JenkinsReadJsonRule(this, 'test/resources/versioning/DubArtifactVersioning/')
|
2019-01-22 10:32:35 +02:00
|
|
|
JenkinsWriteJsonRule writeJsonRule = new JenkinsWriteJsonRule(this)
|
2018-08-08 22:21:26 +02:00
|
|
|
|
|
|
|
@Rule
|
|
|
|
public RuleChain ruleChain = Rules
|
|
|
|
.getCommonRules(this)
|
2019-01-22 10:30:19 +02:00
|
|
|
.around(readJsonRule)
|
2019-01-22 10:32:35 +02:00
|
|
|
.around(writeJsonRule)
|
2018-08-08 22:21:26 +02:00
|
|
|
|
|
|
|
@Test
|
|
|
|
void testVersioning() {
|
2019-07-03 11:27:07 +02:00
|
|
|
DubArtifactVersioning av = new DubArtifactVersioning(nullScript, [filePath: 'dub.json'])
|
2018-08-08 22:21:26 +02:00
|
|
|
assertEquals('1.2.3', av.getVersion())
|
|
|
|
av.setVersion('1.2.3-20180101')
|
2019-01-22 10:32:35 +02:00
|
|
|
assertTrue(writeJsonRule.files['dub.json'].contains('1.2.3-20180101'))
|
2018-08-08 22:21:26 +02:00
|
|
|
}
|
|
|
|
}
|