[jsemver] 13/95: Add methods for incrementing normal version
Alexandre Viau
reazem-guest at moszumanska.debian.org
Mon Feb 16 14:58:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
reazem-guest pushed a commit to branch master
in repository jsemver.
commit 3ef6b4e105120ac9c3777993296863c30630e4e3
Author: Zafar Khaja <zafarkhaja at gmail.com>
Date: Mon Mar 4 02:31:29 2013 +0400
Add methods for incrementing normal version
---
pom.xml | 2 +-
.../java/com/github/zafarkhaja/semver/Version.java | 12 ++++++++++++
.../com/github/zafarkhaja/semver/VersionTest.java | 21 +++++++++++++++++++++
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 567f4bb..88c0b70 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>com.github.zafarkhaja</groupId>
<artifactId>semver</artifactId>
- <version>0.2.1-SNAPSHOT</version>
+ <version>0.3.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>semver</name>
diff --git a/src/main/java/com/github/zafarkhaja/semver/Version.java b/src/main/java/com/github/zafarkhaja/semver/Version.java
index 1860648..72c0569 100644
--- a/src/main/java/com/github/zafarkhaja/semver/Version.java
+++ b/src/main/java/com/github/zafarkhaja/semver/Version.java
@@ -95,6 +95,18 @@ public class Version implements Comparable<Version> {
return new Version(normal, preRelease, build);
}
+ public void incrementMajorVersion() {
+ normal.incrementMajor();
+ }
+
+ public void incrementMinorVersion() {
+ normal.incrementMinor();
+ }
+
+ public void incrementPatchVersion() {
+ normal.incrementPatch();
+ }
+
public int getMajorVersion() {
return normal.getMajor();
}
diff --git a/src/test/java/com/github/zafarkhaja/semver/VersionTest.java b/src/test/java/com/github/zafarkhaja/semver/VersionTest.java
index 2d69971..e1286c7 100644
--- a/src/test/java/com/github/zafarkhaja/semver/VersionTest.java
+++ b/src/test/java/com/github/zafarkhaja/semver/VersionTest.java
@@ -150,6 +150,27 @@ public class VersionTest {
assertEquals("rc.1", v.getPreReleaseVersion());
assertEquals("build.1", v.getBuildVersion());
}
+
+ @Test
+ public void shouldProvideIncrementMajorVersionMethod() {
+ Version v = Version.valueOf("1.2.3");
+ v.incrementMajorVersion();
+ assertEquals("2.0.0", v.toString());
+ }
+
+ @Test
+ public void shouldProvideIncrementMinorVersionMethod() {
+ Version v = Version.valueOf("1.2.3");
+ v.incrementMinorVersion();
+ assertEquals("1.3.0", v.toString());
+ }
+
+ @Test
+ public void shouldProvideIncrementPatchVersionMethod() {
+ Version v = Version.valueOf("1.2.3");
+ v.incrementPatchVersion();
+ assertEquals("1.2.4", v.toString());
+ }
}
public static class EqualsMethodTest {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jsemver.git
More information about the pkg-java-commits
mailing list