File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
main/java/org/scm4j/commons
test/java/org/scm4j/commons Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,10 @@ public String toSnapshotString() {
144144 return prefix + minor + (patch .isEmpty () ? "" : "." + patch ) + SNAPSHOT ;
145145 }
146146
147+ public Version toSnapshot () {
148+ return new Version (toSnapshotString ());
149+ }
150+
147151 public String toReleaseString () {
148152 if (!StringUtils .isNumeric (minor )) {
149153 return verStr ;
Original file line number Diff line number Diff line change 11package org .scm4j .commons ;
22
3- import static org .junit .Assert .assertEquals ;
4- import static org .junit .Assert .assertFalse ;
5- import static org .junit .Assert .assertThat ;
6- import static org .junit .Assert .assertTrue ;
7- import static org .junit .Assert .fail ;
8-
3+ import nl .jqno .equalsverifier .EqualsVerifier ;
94import org .junit .Test ;
105
11- import nl . jqno . equalsverifier . EqualsVerifier ;
6+ import static org . junit . Assert .* ;
127
138public class VersionTest {
149
@@ -172,4 +167,13 @@ public void toSnapshotString() {
172167 assertEquals ("11-SNAPSHOT" , new Version ("11" ).toSnapshotString ());
173168 assertEquals ("asd-SNAPSHOT" , new Version ("asd" ).toSnapshotString ());
174169 }
170+
171+ @ Test
172+ public void toSnapshot () {
173+ assertEquals (new Version ("11.21.31.41-SNAPSHOT" ), new Version ("11.21.31.41" ).toSnapshot ());
174+ assertEquals (new Version ("11.21.31.41-SNAPSHOT" ), new Version ("11.21.31.41-SNAPSHOT" ).toSnapshot ());
175+ assertEquals (new Version ("-SNAPSHOT" ), new Version ("" ).toSnapshot ());
176+ assertEquals (new Version ("11-SNAPSHOT" ), new Version ("11" ).toSnapshot ());
177+ assertEquals (new Version ("asd-SNAPSHOT" ), new Version ("asd" ).toSnapshot ());
178+ }
175179}
You can’t perform that action at this time.
0 commit comments