summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2018-10-08 14:28:48 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-10-09 09:38:53 +0000
commit52b9a0d5103c000f473b038f1cb524696ab78678 (patch)
treee33348b49d9003491c3d5a54eb17b2fecc701f2b /openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api
parent234e6a81f53079b0cd22818df48f39fd479883a4 (diff)
Increased UT coverage -versioning-api-dao-types
Increased UT coverage openecomp-sdc-versioning-api dao-types Change-Id: I1fe246926d44582eb9b6534509885ff21166a1c0 Issue-ID: SDC-1673 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api')
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml4
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java98
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java55
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java70
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java71
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/dao/types/VersionTest.java93
10 files changed, 148 insertions, 369 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml
index 1642ca2b76..e3ace90b49 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml
@@ -14,6 +14,10 @@
<dependencies>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-extras</artifactId>
<version>${datastax.cassandra.version}</version>
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java
index 492e75fdbb..9246060982 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java
@@ -1,42 +1,14 @@
package org.openecomp.sdc.versioning.dao.types;
+import lombok.Getter;
+import lombok.Setter;
import java.util.Date;
+@Getter
+@Setter
public class Revision {
private String id;
private String message;
private Date time;
private String user;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public String getMessage() {
- return message;
- }
-
- public Date getTime() {
- return time;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java
index ca044142de..9dfab56b6d 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java
@@ -22,35 +22,19 @@ package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.UDT;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@UDT(name = "user_candidate_version", keyspace = "dox")
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
public class UserCandidateVersion {
-
+ private String user;
@Frozen
private Version version;
- private String user;
-
- public UserCandidateVersion() {
- }
-
- public UserCandidateVersion(String user, Version candidateVersion) {
- this.user = user;
- this.version = candidateVersion;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
}
+
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
index b822f13c76..d0efcf93fe 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
@@ -22,11 +22,17 @@ package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.Transient;
import com.datastax.driver.mapping.annotations.UDT;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import java.util.Date;
import java.util.Map;
@UDT(name = "version", keyspace = "dox")
+@Getter
+@Setter
+@NoArgsConstructor
public class Version {
public static final String VERSION_STRING_VIOLATION_MSG =
"Version string must be in the format of: {integer}.{integer}";
@@ -52,9 +58,6 @@ public class Version {
@Transient
private Map<String, Object> additionalInfo;
- public Version() {
- }
-
public Version(String id) {
this.id = id;
}
@@ -88,87 +91,6 @@ public class Version {
return version;
}
-
- public int getMajor() {
- return major;
- }
-
- public void setMajor(int major) {
- this.major = major;
- }
-
- public int getMinor() {
- return minor;
- }
-
- public void setMinor(int minor) {
- this.minor = minor;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getBaseId() {
- return baseId;
- }
-
- public void setBaseId(String baseId) {
- this.baseId = baseId;
- }
-
- public Date getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Date creationTime) {
- this.creationTime = creationTime;
- }
-
- public Date getModificationTime() {
- return modificationTime;
- }
-
- public void setModificationTime(Date modificationTime) {
- this.modificationTime = modificationTime;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public VersionState getState() {
- return state;
- }
-
- public void setState(VersionState state) {
- this.state = state;
- }
-
public Version calculateNextCandidate() {
return new Version(major, minor + 1);
}
@@ -182,14 +104,6 @@ public class Version {
return major != 0 && minor == 0;
}
- public Map<String, Object> getAdditionalInfo() {
- return additionalInfo;
- }
-
- public void setAdditionalInfo(Map<String, Object> additionalInfo) {
- this.additionalInfo = additionalInfo;
- }
-
@Override
public int hashCode() {
int result = major;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java
index 9d1093babc..b382ce5401 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java
@@ -24,8 +24,14 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@Table(keyspace = "dox", name = "version_history")
+@Getter
+@Setter
+@NoArgsConstructor
public class VersionHistoryEntity {
@PartitionKey
@@ -41,56 +47,7 @@ public class VersionHistoryEntity {
private String description;
private VersionType type;
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public VersionHistoryEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
public VersionHistoryEntity(VersionableEntityId entityId) {
this.entityId = entityId;
}
-
- public VersionableEntityId getEntityId() {
- return entityId;
- }
-
- public void setEntityId(VersionableEntityId entityId) {
- this.entityId = entityId;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public VersionType getType() {
- return type;
- }
-
- public void setType(VersionType type) {
- this.type = type;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
index fd56b7b50b..12b82f7aed 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
@@ -26,11 +26,17 @@ import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.FrozenValue;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import java.util.HashSet;
import java.util.Set;
@Table(keyspace = "dox", name = "version_info_deleted")
+@Getter
+@Setter
+@NoArgsConstructor
public class VersionInfoDeletedEntity {
@PartitionKey
@@ -58,73 +64,9 @@ public class VersionInfoDeletedEntity {
@Frozen
private Version latestFinalVersion;
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public VersionInfoDeletedEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
public VersionInfoDeletedEntity(String entityType, String entityId) {
this.entityType = entityType;
this.entityId = entityId;
}
- public String getEntityType() {
- return entityType;
- }
-
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public String getEntityId() {
- return entityId;
- }
-
- public void setEntityId(String entityId) {
- this.entityId = entityId;
- }
-
- public Version getActiveVersion() {
- return activeVersion;
- }
-
- public void setActiveVersion(Version activeVersion) {
- this.activeVersion = activeVersion;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public UserCandidateVersion getCandidate() {
- return candidate;
- }
-
- public void setCandidate(UserCandidateVersion candidate) {
- this.candidate = candidate;
- }
-
- public Set<Version> getViewableVersions() {
- return viewableVersions;
- }
-
- public void setViewableVersions(Set<Version> viewableVersions) {
- this.viewableVersions = viewableVersions;
- }
-
- public Version getLatestFinalVersion() {
- return latestFinalVersion;
- }
-
- public void setLatestFinalVersion(Version latestFinalVersion) {
- this.latestFinalVersion = latestFinalVersion;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
index 46baaf461c..84444a30c6 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
@@ -26,11 +26,17 @@ import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.FrozenValue;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import java.util.HashSet;
import java.util.Set;
@Table(keyspace = "dox", name = "version_info")
+@Getter
+@Setter
+@NoArgsConstructor
public class VersionInfoEntity {
@PartitionKey
@@ -58,73 +64,8 @@ public class VersionInfoEntity {
@Frozen
private Version latestFinalVersion;
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public VersionInfoEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
public VersionInfoEntity(String entityType, String entityId) {
this.entityType = entityType;
this.entityId = entityId;
}
-
- public String getEntityType() {
- return entityType;
- }
-
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public String getEntityId() {
- return entityId;
- }
-
- public void setEntityId(String entityId) {
- this.entityId = entityId;
- }
-
- public Version getActiveVersion() {
- return activeVersion;
- }
-
- public void setActiveVersion(Version activeVersion) {
- this.activeVersion = activeVersion;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public UserCandidateVersion getCandidate() {
- return candidate;
- }
-
- public void setCandidate(UserCandidateVersion candidate) {
- this.candidate = candidate;
- }
-
- public Set<Version> getViewableVersions() {
- return viewableVersions;
- }
-
- public void setViewableVersions(Set<Version> viewableVersions) {
- this.viewableVersions = viewableVersions;
- }
-
- public Version getLatestFinalVersion() {
- return latestFinalVersion;
- }
-
- public void setLatestFinalVersion(Version latestFinalVersion) {
- this.latestFinalVersion = latestFinalVersion;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java
index 8d489802b7..d206457ee8 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java
@@ -1,23 +1,11 @@
package org.openecomp.sdc.versioning.dao.types;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
public class VersionState {
private SynchronizationState synchronizationState;
private boolean dirty;
-
- public SynchronizationState getSynchronizationState() {
- return synchronizationState;
- }
-
- public void setSynchronizationState(
- SynchronizationState synchronizationState) {
- this.synchronizationState = synchronizationState;
- }
-
- public boolean isDirty() {
- return dirty;
- }
-
- public void setDirty(boolean dirty) {
- this.dirty = dirty;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java
index 78dc1b8811..690b7b3689 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java
@@ -21,33 +21,17 @@
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.UDT;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@UDT(name = "versionable_entity_id", keyspace = "dox")
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
public class VersionableEntityId {
private String type;
private String id;
-
- public VersionableEntityId() {
- }
-
- public VersionableEntityId(String type, String id) {
- this.type = type;
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/dao/types/VersionTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/dao/types/VersionTest.java
new file mode 100644
index 0000000000..30cdbbdc70
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/dao/types/VersionTest.java
@@ -0,0 +1,93 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.openecomp.sdc.versioning.dao.types;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class VersionTest {
+ @Test
+ public void testValueOfPositive() {
+ Version version = Version.valueOf("1.1");
+ Assert.assertEquals(1, version.getMajor());
+ Assert.assertEquals(1, version.getMinor());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testValueOfWihLengthOne() {
+ Version version = Version.valueOf("1");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testValueOfNegative() {
+ Version version = Version.valueOf("1a.1");
+ }
+ @Test
+ public void testValueOfNullVersion() {
+ Version version = Version.valueOf(null);
+ Assert.assertNull(version);
+ }
+
+ @Test
+ public void testCalculateNextCandidate() {
+ Version version = new Version();
+ version.setMinor(1);
+ Assert.assertEquals(2, version.calculateNextCandidate().getMinor());
+ }
+
+ @Test
+ public void testCalculateNextCandidateFinal() {
+ Version version = new Version();
+ version.setMajor(0);
+ Assert.assertEquals(1, version.calculateNextFinal().getMajor());
+ }
+
+ @Test
+ public void testCompareTo() {
+ Version version = new Version();
+ version.setMajor(1);
+
+ Version versionToCompare = new Version();
+ versionToCompare.setMajor(1);
+ Assert.assertEquals(0, version.compareTo(versionToCompare));
+ }
+
+ @Test
+ public void testVersionEquals() {
+ Version version = new Version();
+ version.setMajor(0);
+ version.setMinor(2);
+ Version versionToCompare = new Version();
+ versionToCompare.setMajor(0);
+ versionToCompare.setMinor(2);
+
+ Assert.assertTrue(version.equals(versionToCompare));
+ }
+
+ @Test
+ public void testVersionClone() {
+ Version version = new Version("1.0");
+ Assert.assertEquals(version, version.clone());
+ }
+
+ @Test
+ public void testVersionHashcode() {
+ Version version = new Version("1.0");
+ Assert.assertEquals((31 * (version.getMajor())+ version.getMinor()), version.hashCode());
+ }
+} \ No newline at end of file