From ff0842117fba4dfe675a8b87af3a1098cde023bd Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 29 Jun 2020 10:16:44 -0400 Subject: Fix issues in common for new sonar rules Addressed issues reported due to updates to the sonar rules: - invoke only one method in a junit lambda - complete the assertion - add DOCTYPE to html Issue-ID: POLICY-2650 Change-Id: Ib8b8a2e4736cc23849c0f7aef972ffa3365a3e00 Signed-off-by: Jim Hahn --- .../org/onap/policy/common/utils/gson/GsonTestUtilsTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java') diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java index 11ee63c0..f16764c9 100644 --- a/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java +++ b/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java @@ -76,10 +76,11 @@ public class GsonTestUtilsTest { utils.compareGson(data, GsonTestUtilsTest.class); // file not found - assertThatThrownBy(() -> utils.compareGson(data, - new File(GsonTestUtilsTest.class.getSimpleName() + "-NotFound.json"))) - .isInstanceOf(JsonParseException.class) - .hasCauseInstanceOf(FileNotFoundException.class); + File file = new File(GsonTestUtilsTest.class.getSimpleName() + "-NotFound.json"); + + assertThatThrownBy(() -> utils.compareGson(data, file)) + .isInstanceOf(JsonParseException.class) + .hasCauseInstanceOf(FileNotFoundException.class); // force I/O error while reading file GsonTestUtils utils2 = new GsonTestUtils() { -- cgit 1.2.3-korg