1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.shared.release.policy.oddeven;
20
21 import org.apache.maven.shared.release.policy.version.VersionPolicy;
22 import org.apache.maven.shared.release.policy.version.VersionPolicyRequest;
23 import org.junit.Test;
24
25 import static org.junit.Assert.assertEquals;
26
27 public final class OddEvenVersionPolicyTestCase {
28
29 private final VersionPolicy versionPolicy = new OddEvenVersionPolicy();
30
31 @Test
32 public void testConvertToSnapshot() throws Exception {
33 String suggestedVersion = versionPolicy
34 .getDevelopmentVersion(newVersionPolicyRequest("1.0.0"))
35 .getVersion();
36
37 assertEquals("1.0.1-SNAPSHOT", suggestedVersion);
38 }
39
40 @Test
41 public void testConvertToRelease() throws Exception {
42 String suggestedVersion = versionPolicy
43 .getReleaseVersion(newVersionPolicyRequest("1.0.0-SNAPSHOT"))
44 .getVersion();
45
46 assertEquals("1.0.0", suggestedVersion);
47 }
48
49 @Test
50 public void testConvertOddToRelease() throws Exception {
51 String suggestedVersion = versionPolicy
52 .getReleaseVersion(newVersionPolicyRequest("1.0.1-SNAPSHOT"))
53 .getVersion();
54
55 assertEquals("1.0.2", suggestedVersion);
56 }
57
58 private static VersionPolicyRequest newVersionPolicyRequest(String version) {
59 return new VersionPolicyRequest().setVersion(version);
60 }
61 }