From: Tomasz Pietruszkiewicz Date: Thu, 21 Jan 2021 10:29:13 +0000 (+0100) Subject: Fix critical bug in sonar in SecurityManagerTest.java X-Git-Tag: 1.8.1~13 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F40%2F117040%2F2;p=sdc.git Fix critical bug in sonar in SecurityManagerTest.java Change-Id: I2ea2a7c859ea01f86e66440816427f1d5355fa72 Issue-ID: SDC-3444 Signed-off-by: Tomasz Pietruszkiewicz --- diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManagerTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManagerTest.java index 0ed871d47c..306bc322dc 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManagerTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManagerTest.java @@ -86,13 +86,14 @@ public class SecurityManagerTest { @Test public void testGetCertificatesException() throws IOException, SecurityManagerException { + File newFile = new File(cerDirPath + "root-certificate.pem"); + newFile.createNewFile(); Assertions.assertThrows(SecurityManagerException.class, () -> { - File newFile = new File(cerDirPath + "root-certificate.pem"); - newFile.createNewFile(); assertEquals(1, securityManager.getTrustedCertificates().size()); - newFile.delete(); - assertEquals(0, securityManager.getTrustedCertificates().size()); }); + newFile.delete(); + assertEquals(0, securityManager.getTrustedCertificates().size()); + } @Test