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