From d8cb161f678bbb421193cfd2b6033f172d1eda48 Mon Sep 17 00:00:00 2001 From: rathnapandi Date: Wed, 15 Mar 2023 11:43:54 -0700 Subject: [PATCH] - Fix for JDK 1.8 compatibility --- .../test/impl/CheckCertificatesTest.java | 16 +++++------ .../test/impl/ConsoleAPIExportTest.java | 27 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/modules/apis/src/test/java/com/axway/apim/export/test/impl/CheckCertificatesTest.java b/modules/apis/src/test/java/com/axway/apim/export/test/impl/CheckCertificatesTest.java index bfd2b9a49..0ba9fd6ef 100644 --- a/modules/apis/src/test/java/com/axway/apim/export/test/impl/CheckCertificatesTest.java +++ b/modules/apis/src/test/java/com/axway/apim/export/test/impl/CheckCertificatesTest.java @@ -1,6 +1,5 @@ package com.axway.apim.export.test.impl; -import com.axway.apim.adapter.APIManagerAdapter; import com.axway.apim.api.API; import com.axway.apim.api.export.impl.CheckCertificatesAPIHandler; import com.axway.apim.api.export.lib.cli.CLICheckCertificatesOptions; @@ -18,8 +17,7 @@ import java.io.IOException; import java.util.List; -public class CheckCertificatesTest { - +public class CheckCertificatesTest { private static final String TEST_PACKAGE = "test/export/files/apiLists/"; @@ -33,9 +31,9 @@ public void setTest() { } @Test - public void checkCertNothingAboutToExpire() throws IOException { + public void checkCertNothingAboutToExpire() throws IOException { - List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() { + List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference>() { }); APICheckCertificatesParams params = (APICheckCertificatesParams) CLICheckCertificatesOptions.create(new String[]{"-days", "30"}).getParams(); @@ -47,16 +45,16 @@ public void checkCertNothingAboutToExpire() throws IOException { @Test public void checkSomeExpiredCerts() throws IOException { - List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() { + List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference>() { }); APICheckCertificatesParams params = (APICheckCertificatesParams) CLICheckCertificatesOptions.create(new String[]{"-days", "23350"}).getParams(); CheckCertificatesAPIHandler checkCerts = new CheckCertificatesAPIHandler(params); checkCerts.execute(apis); Result result = checkCerts.getResult(); - Assert.assertTrue(result.getErrorCode() == ErrorCode.CHECK_CERTS_FOUND_CERTS); + Assert.assertSame(result.getErrorCode(), ErrorCode.CHECK_CERTS_FOUND_CERTS); @SuppressWarnings("unchecked") List expiredCert = (List) result.getResultDetails(); - Assert.assertTrue(expiredCert.size() == 1, "Expect one certificate to expire"); + Assert.assertEquals(expiredCert.size(), 1, "Expect one certificate to expire"); } -} \ No newline at end of file +} diff --git a/modules/apis/src/test/java/com/axway/apim/export/test/impl/ConsoleAPIExportTest.java b/modules/apis/src/test/java/com/axway/apim/export/test/impl/ConsoleAPIExportTest.java index 4a9901e14..4543040de 100644 --- a/modules/apis/src/test/java/com/axway/apim/export/test/impl/ConsoleAPIExportTest.java +++ b/modules/apis/src/test/java/com/axway/apim/export/test/impl/ConsoleAPIExportTest.java @@ -1,6 +1,5 @@ package com.axway.apim.export.test.impl; -import com.axway.apim.adapter.APIManagerAdapter; import com.axway.apim.api.API; import com.axway.apim.api.export.impl.ConsoleAPIExporter; import com.axway.apim.api.export.lib.cli.CLIAPIExportOptions; @@ -15,43 +14,43 @@ import java.util.List; public class ConsoleAPIExportTest { - + private static final String TEST_PACKAGE = "test/export/files/apiLists/"; - + ObjectMapper mapper = new ObjectMapper(); - - + + @BeforeClass public void setTest() { mapper.disable(MapperFeature.USE_ANNOTATIONS); } - + @Test public void runStandardConsoleAPIExport() throws IOException { - List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() { + List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference>() { }); APIExportParams cmdParams = (APIExportParams) CLIAPIExportOptions.create(new String[] {}).getParams(); ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams); consoleExp.execute(apis); } - + @Test public void runWideConsoleAPIExport() throws IOException { - List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() { + List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference>() { }); - + APIExportParams cmdParams = (APIExportParams) CLIAPIExportOptions.create(new String[] {"-wide"}).getParams(); ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams); consoleExp.execute(apis); } - + @Test public void runUltraConsoleAPIExport() throws IOException { - List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() { + List apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference>() { }); - + APIExportParams cmdParams = (APIExportParams) CLIAPIExportOptions.create(new String[] {"-ultra"}).getParams(); ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams); consoleExp.execute(apis); } -} \ No newline at end of file +}