diff options
author | 2025-01-09 10:18:33 +0000 | |
---|---|---|
committer | 2025-01-09 10:19:40 +0000 | |
commit | 6c92566dd754a7b54e3ee34b5bac5c041c799c72 (patch) | |
tree | dd6e144cb94b170b6c10481823624c9418089fd3 /utils/src | |
parent | 2d2f5489c70e1334df2779390b67a53bd47a13c3 (diff) |
Fix sonar issues
- fixing sonar issues on code to generate a new common artifact
with parent new dependencies.
Issue-ID: POLICY-5240
Change-Id: I47b2ace072708e576d5fc5a82c2419925cbed7ed
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'utils/src')
3 files changed, 8 insertions, 10 deletions
diff --git a/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java b/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java index d45f43b0..5559155f 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation + * Modifications Copyright (C) 2024-2025 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ class PropertyCoderTest { * For "pass", the encrypted value was generated via: * java org.onap.policy.common.utils.security.CryptoUtils enc hello abcdefghijklmnopqrstuvwxyzabcdef */ - private static final String json = + private static final String JSON = ("{'aes_encryption_key':'abcdefghijklmnopqrstuvwxyzabcdef'" + ",'xacml.pdp.rest.password':'enc:FSfOhDygtmnX3gkMSfTFMoBFW+AG5k6goNj2KZgQmeF0DqgcMg=='" + ",'xacml.pdp.rest.user':'testpdp'" @@ -72,7 +72,7 @@ class PropertyCoderTest { @Test void testPropertyCoder() { - MyClass data = propertyCoder.decode(json, AES_ENCRYPTION_KEY, MyClass.class); + MyClass data = propertyCoder.decode(JSON, AES_ENCRYPTION_KEY, MyClass.class); assertEquals("alpha", data.getPdpRestPass()); assertEquals("hello", data.servers.get(0).pass); assertEquals("server1", data.servers.get(0).name); @@ -82,7 +82,7 @@ class PropertyCoderTest { @Test void testPropertyCoderReader() { - Reader reader = new StringReader(json); + Reader reader = new StringReader(JSON); MyClass data = propertyCoder.decode(reader, AES_ENCRYPTION_KEY, MyClass.class); assertEquals("alpha", data.getPdpRestPass()); assertEquals("hello", data.servers.get(0).pass); diff --git a/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java b/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java index c597b7f6..0e4967be 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation + * Modifications Copyright (C) 2024-2025 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ class StandardCoderObjectTest { private static final String PROP1 = "abc"; private static final String PROP2 = "ghi"; private static final Integer PROP2_INDEX = 1; - private static final String PROP2b = "jkl"; + private static final String PROP_2_B = "jkl"; private static final String VAL1 = "def"; private static final String VAL2 = "mno"; private static final String JSON = "{'abc':'def','ghi':[{},{'jkl':'mno'}]}".replace('\'', '"'); @@ -71,7 +71,7 @@ class StandardCoderObjectTest { assertEquals(VAL1, sco.getString(PROP1)); // multiple fields - assertEquals(VAL2, sco.getString(PROP2, PROP2_INDEX, PROP2b)); + assertEquals(VAL2, sco.getString(PROP2, PROP2_INDEX, PROP_2_B)); // not found assertNull(sco.getString("xyz")); diff --git a/utils/src/test/java/org/onap/policy/common/utils/validation/TestParameterValidationUtils.java b/utils/src/test/java/org/onap/policy/common/utils/validation/TestParameterValidationUtils.java index a85e8ec8..9f10ba9a 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/validation/TestParameterValidationUtils.java +++ b/utils/src/test/java/org/onap/policy/common/utils/validation/TestParameterValidationUtils.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2024 Nordix Foundation + * Modifications Copyright (C) 2024-2025 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,6 @@ class TestParameterValidationUtils { @Test void testValidateIntParameter() { assertTrue(ParameterValidationUtils.validateIntParameter(5555)); - assertTrue(ParameterValidationUtils.validateIntParameter(Integer.valueOf(7777))); assertFalse(ParameterValidationUtils.validateIntParameter(0)); assertFalse(ParameterValidationUtils.validateIntParameter(-1)); } @@ -52,7 +51,6 @@ class TestParameterValidationUtils { @Test void testValidateLongParameter() { assertTrue(ParameterValidationUtils.validateLongParameter(5555L)); - assertTrue(ParameterValidationUtils.validateLongParameter(Long.valueOf(7777L))); assertFalse(ParameterValidationUtils.validateLongParameter(0L)); assertFalse(ParameterValidationUtils.validateLongParameter(-1L)); } |