From ac3b789c707846274a155e123c8f2de695bd22bb Mon Sep 17 00:00:00 2001 From: shrek2000 Date: Thu, 28 Nov 2019 10:53:50 +0200 Subject: Fix Sonar issues lombok helps to increase code coverage Issue-ID: SDC-2690 Signed-off-by: shrek2000 Change-Id: I076c200befe2c1c887db81fe6db8e00af3556f36 --- .../onap/sdc/security/AuthenticationCookie.java | 34 +++------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/security-util-lib/src/main/java/org/onap/sdc/security/AuthenticationCookie.java b/security-util-lib/src/main/java/org/onap/sdc/security/AuthenticationCookie.java index 9440eea..b8f3afa 100644 --- a/security-util-lib/src/main/java/org/onap/sdc/security/AuthenticationCookie.java +++ b/security-util-lib/src/main/java/org/onap/sdc/security/AuthenticationCookie.java @@ -21,9 +21,13 @@ package org.onap.sdc.security; import java.util.Set; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; +import lombok.ToString; +@EqualsAndHashCode +@ToString public class AuthenticationCookie { @Getter @Setter @@ -72,35 +76,5 @@ public class AuthenticationCookie { this.lastName = lastName; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof AuthenticationCookie)) return false; - AuthenticationCookie that = (AuthenticationCookie) o; - - if (getMaxSessionTime() != that.getMaxSessionTime()) return false; - if (getCurrentSessionTime() != that.getCurrentSessionTime()) return false; - if (getUserID() != null ? !getUserID().equals(that.getUserID()) : that.getUserID() != null) return false; - return getRoles() != null ? getRoles().containsAll(that.getRoles()) : that.getRoles() == null; - } - - @Override - public int hashCode() { - int result = getUserID() != null ? getUserID().hashCode() : 0; - result = 31 * result + (getRoles() != null ? getRoles().hashCode() : 0); - result = 31 * result + (int) (getMaxSessionTime() ^ (getMaxSessionTime() >>> 32)); - result = 31 * result + (int) (getCurrentSessionTime() ^ (getCurrentSessionTime() >>> 32)); - return result; - } - - @Override - public String toString() { - return "AuthenticationCookie{" + - "userID='" + userID + '\'' + - ", roles=" + roles + - ", maxSessionTime=" + maxSessionTime + - ", currentSessionTime=" + currentSessionTime + - '}'; - } } -- cgit 1.2.3-korg