5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.openjdk.skara.vcs.openjdk;
24
25 import org.junit.jupiter.api.Test;
26 import static org.junit.jupiter.api.Assertions.*;
27
28 import org.openjdk.skara.vcs.Tag;
29
30 class OpenJDKTagTests {
31 @Test
32 void parseTags() {
33 var tag = new Tag("jdk-10+20");
34 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
35 assertEquals(20, jdkTag.buildNum());
36 var previousTag = jdkTag.previous().orElseThrow();
37 assertEquals(19, previousTag.buildNum());
38 }
39
40 @Test
41 void parseSingleDigitTags() {
42 var tag = new Tag("jdk-10+10");
43 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
44 assertEquals(10, jdkTag.buildNum());
45 var previousTag = jdkTag.previous().orElseThrow();
46 assertEquals("jdk-10+9", previousTag.tag().name());
47 assertEquals(9, previousTag.buildNum());
48 }
75 assertEquals(18, previousTag.buildNum());
76 }
77
78 @Test
79 void parseSingleDigitHotspotTags() {
80 var tag = new Tag("hs23.6-b10");
81 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
82 assertEquals(10, jdkTag.buildNum());
83 var previousTag = jdkTag.previous().orElseThrow();
84 assertEquals("hs23.6-b09", previousTag.tag().name());
85 assertEquals(9, previousTag.buildNum());
86 }
87
88 @Test
89 void noPrevious() {
90 var tag = new Tag("jdk-10+0");
91 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
92 assertEquals(0, jdkTag.buildNum());
93 assertFalse(jdkTag.previous().isPresent());
94 }
95 }
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.openjdk.skara.vcs.openjdk;
24
25 import org.openjdk.skara.vcs.Tag;
26
27 import org.junit.jupiter.api.Test;
28
29 import static org.junit.jupiter.api.Assertions.*;
30
31 class OpenJDKTagTests {
32 @Test
33 void parseTags() {
34 var tag = new Tag("jdk-10+20");
35 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
36 assertEquals(20, jdkTag.buildNum());
37 var previousTag = jdkTag.previous().orElseThrow();
38 assertEquals(19, previousTag.buildNum());
39 }
40
41 @Test
42 void parseSingleDigitTags() {
43 var tag = new Tag("jdk-10+10");
44 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
45 assertEquals(10, jdkTag.buildNum());
46 var previousTag = jdkTag.previous().orElseThrow();
47 assertEquals("jdk-10+9", previousTag.tag().name());
48 assertEquals(9, previousTag.buildNum());
49 }
76 assertEquals(18, previousTag.buildNum());
77 }
78
79 @Test
80 void parseSingleDigitHotspotTags() {
81 var tag = new Tag("hs23.6-b10");
82 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
83 assertEquals(10, jdkTag.buildNum());
84 var previousTag = jdkTag.previous().orElseThrow();
85 assertEquals("hs23.6-b09", previousTag.tag().name());
86 assertEquals(9, previousTag.buildNum());
87 }
88
89 @Test
90 void noPrevious() {
91 var tag = new Tag("jdk-10+0");
92 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
93 assertEquals(0, jdkTag.buildNum());
94 assertFalse(jdkTag.previous().isPresent());
95 }
96
97 @Test
98 void parseJfxTags() {
99 var tag = new Tag("12.1.3+14");
100 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
101 assertEquals("12.1.3", jdkTag.version());
102 assertEquals(14, jdkTag.buildNum());
103 var previousTag = jdkTag.previous().orElseThrow();
104 assertEquals(13, previousTag.buildNum());
105 }
106
107 @Test
108 void parseJfxTagsGa() {
109 var tag = new Tag("12.1-ga");
110 var jdkTag = OpenJDKTag.create(tag).orElseThrow();
111 assertEquals("12.1", jdkTag.version());
112 assertEquals(0, jdkTag.buildNum());
113 }
114 }
|