diff options
author | Jim Hahn <jrh3@att.com> | 2021-02-10 14:23:02 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-02-10 14:26:29 -0500 |
commit | e3035927b9c49478e28e5ca7fca7c42c43b7300e (patch) | |
tree | 4d06bcb63231427fbc07ed77f4c7d9f0f483440e /utils-test/src/main | |
parent | 98d2ab1beb887658521d4ff42ba6b17a97f8ebae (diff) |
More sonar issues in common
Addressed the issues:
- use of eq() in verify()
- remove @NamedQueries
- use computeIfAbsent()
Issue-ID: POLICY-2914
Change-Id: I265bc98f0f326e7b4ce86c25e68fc4859bd7fb02
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'utils-test/src/main')
-rw-r--r-- | utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtils.java | 8 | ||||
-rw-r--r-- | utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtils.java b/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtils.java index 01206c32..e267179e 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtils.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/gson/GsonTestUtils.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * policy-management * ================================================================================ - * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -169,7 +169,11 @@ public class GsonTestUtils { JsonElement gsonjo = reorder(gson.fromJson(sgson, JsonElement.class)); JsonElement expjo = reorder(expected); - assertEquals(expjo.toString(), gsonjo.toString()); + /* + * As this method is only used within junit tests, it is OK to use assert calls, + * thus sonar is disabled. + */ + assertEquals(expjo.toString(), gsonjo.toString()); // NOSONAR } /** diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java b/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java index f4b36a00..54ec601a 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -189,11 +189,13 @@ public class TestTimeMulti extends TestTime { } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("interrupted while waiting for condition", e); - fail("interrupted while waiting for condition: " + e.getMessage()); + // disabling sonar, as this is only used by junit tests + fail("interrupted while waiting for condition: " + e.getMessage()); // NOSONAR } catch (Exception e) { logger.error("condition evaluator threw an exception", e); - fail("condition evaluator threw an exception: " + e.getMessage()); + // disabling sonar, as this is only used by junit tests + fail("condition evaluator threw an exception: " + e.getMessage()); // NOSONAR } fail(NEVER_SATISFIED); |