From 121520b5778990827f5e2e7a06a41e30bed1602c Mon Sep 17 00:00:00 2001 From: Antonio Tarricone <110115827+antoniotarricone@users.noreply.github.com> Date: Mon, 19 Jun 2023 09:58:19 +0200 Subject: [PATCH] fix: New post-merge workflow. (#46) --- .github/workflows/post-merge.yml | 279 ++++++++++++++++++ .github/workflows/release.yml | 11 +- .releaserc.json | 2 +- .../swclient/mil/auth/bean/RoleEnum.java | 8 +- .../mil/auth/resource/JwksResource.java | 8 +- .../mil/auth/service/ClientVerifier.java | 2 +- .../auth/resource/RequestValidationTest.java | 74 ++--- .../mil/auth/resource/TokenResourceTest.java | 22 +- ...kenResourceWithExcOnClientSecrVerTest.java | 4 +- .../service/KeyFinderWithExceptionTest.java | 8 +- 10 files changed, 349 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/post-merge.yml diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml new file mode 100644 index 00000000..02a92ebe --- /dev/null +++ b/.github/workflows/post-merge.yml @@ -0,0 +1,279 @@ +name: Post-merge workflow + +on: + pull_request: + types: + - closed + branches: + - main + +jobs: + post_merge: + if: github.event.pull_request.merged == true + + runs-on: ubuntu-latest + + environment: dev-cd + + permissions: + id-token: write + + #outputs: + # new_release_published: ${{ steps.semantic.outputs.new_release_published }} + # new_release_version: ${{ steps.semantic.outputs.new_release_version }} + + steps: + # + # Checkout the source code. + # + - name: Checkout the source code + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + with: + token: ${{ secrets.GIT_PAT }} + fetch-depth: 0 + + # + # Calculate of the new version (dry-run). + # + - name: Calculate of the new version (dry-run) + uses: cycjimmy/semantic-release-action@8e58d20d0f6c8773181f43eb74d6a05e3099571d + id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + semantic_version: 19 + branch: main + extra_plugins: | + @semantic-release/release-notes-generator@10.0.3 + @semantic-release/git@10.0.1 + dry_run: true + + # + # Cache JDK. + # + - name: Cache JDK + if: steps.semantic.outputs.new_release_published == 'true' + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + id: cache-jdk + with: + key: OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz + path: | + ${{ runner.temp }}/jdk_setup.tar.gz + ${{ runner.temp }}/jdk_setup.sha256 + + # + # Download JDK and verify its hash. + # + - name: Download JDK and verify its hash + if: steps.semantic.outputs.new_release_published == 'true' && steps.cache-jdk.outputs.cache-hit != 'true' + run: | + echo "e9458b38e97358850902c2936a1bb5f35f6cffc59da9fcd28c63eab8dbbfbc3b ${{ runner.temp }}/jdk_setup.tar.gz" >> ${{ runner.temp }}/jdk_setup.sha256 + curl -L "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz" -o "${{ runner.temp }}/jdk_setup.tar.gz" + sha256sum --check --status "${{ runner.temp }}/jdk_setup.sha256" + + # + # Setup JDK. + # + - name: Setup JDK + if: steps.semantic.outputs.new_release_published == 'true' + uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 + with: + distribution: "jdkfile" + jdkFile: "${{ runner.temp }}/jdk_setup.tar.gz" + java-version: "17" + cache: maven + + # + # Cache Maven. + # + - name: Cache Maven + if: steps.semantic.outputs.new_release_published == 'true' + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + id: cache-maven + with: + key: apache-maven-3.9.2-bin.tar.gz + path: | + ${{ runner.temp }}/maven_setup.tar.gz + ${{ runner.temp }}/maven_setup.sha256 + + # + # Download Maven and verify its hash. + # + - name: Download Maven and verify its hash + if: steps.semantic.outputs.new_release_published == 'true' && steps.cache-maven.outputs.cache-hit != 'true' + run: | + echo "809ef3220c6d179195c06c324cb9a6d34d8ecba566c5cfd8eb83167bc034117d ${{ runner.temp }}/maven_setup.tar.gz" >> ${{ runner.temp }}/maven_setup.sha256 + curl -L "https://dlcdn.apache.org/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz" -o "${{ runner.temp }}/maven_setup.tar.gz" + sha256sum --check --status "${{ runner.temp }}/maven_setup.sha256" + + # + # Setup Maven. + # + - name: Setup Maven + if: steps.semantic.outputs.new_release_published == 'true' + run: | + mkdir ${{ runner.temp }}/maven + tar -xvf ${{ runner.temp }}/maven_setup.tar.gz -C ${{ runner.temp }}/maven --strip-components=1 + echo "github${{ secrets.GIT_USER }}${{ secrets.GIT_PAT }}" >> ${{ runner.temp }}/settings.xml + + # + # Update of pom.xml with the new version + "-RC". + # + - name: Update of pom.xml with the new version + "-RC" + if: steps.semantic.outputs.new_release_published == 'true' + run: ${{ runner.temp }}/maven/bin/mvn versions:set -DnewVersion=${{ steps.semantic.outputs.new_release_version }}-RC -s ${{ runner.temp }}/settings.xml --no-transfer-progress + + # + # Execute unit-test + Calculate test coverage + SCA with Sonar. + # + - name: Execute unit-test + Calculate test coverage + SCA with Sonar + if: steps.semantic.outputs.new_release_published == 'true' + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ${{ runner.temp }}/maven/bin/mvn verify -Pvalidate -s ${{ runner.temp }}/settings.xml --no-transfer-progress + + # + # Build native executable. + # + - name: Build native executable + if: steps.semantic.outputs.new_release_published == 'true' + run: ${{ runner.temp }}/maven/bin/mvn clean package -Pnative -Dmaven.test.skip=true -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image@sha256:05baf3fd2173f6f25ad35216b6b066c35fbfb97f06daba75efb5b22bc0a85b9c -s ${{ runner.temp }}/settings.xml --no-transfer-progress + + # + # Build Docker image. + # + - name: Build Docker image + if: steps.semantic.outputs.new_release_published == 'true' + run: docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC . + + # + # Push Docker image. + # + - name: Push Docker image + if: steps.semantic.outputs.new_release_published == 'true' + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + docker push -a ghcr.io/${{ github.repository }} + + # + # Login to Azure. + # + - name: Login to Azure + if: steps.semantic.outputs.new_release_published == 'true' + uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + # + # Update Container App. + # + - name: Update Container App + if: steps.semantic.outputs.new_release_published == 'true' + uses: azure/CLI@fa0f960f00db49b95fdb54328a767aee31e80105 + with: + inlineScript: | + az config set extension.use_dynamic_install=yes_without_prompt + az containerapp update -n ${{ secrets.AZURE_CONTAINER_APP_NAME }} -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} --image ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC + + # + # Install Node. + # + - name: Install Node + if: steps.semantic.outputs.new_release_published == 'true' + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c + with: + node-version: "18.16.0" + + # + # Install Newman. + # + - name: Install Newman + if: steps.semantic.outputs.new_release_published == 'true' + run: npm install -g newman + + # + # Run Postman collection. + # + - name: Run Postman collection + if: steps.semantic.outputs.new_release_published == 'true' + run: newman run src/test/postman/mil-auth.postman_collection.json -e src/test/postman/dev.postman_environment.json + + # ----------------------------------------------------------------------- + # "-RC" removal. + # ----------------------------------------------------------------------- + + # + # Update of pom.xml with the new version. + # + - name: Update of pom.xml with the new version + if: steps.semantic.outputs.new_release_published == 'true' + run: | + ${{ runner.temp }}/maven/bin/mvn versions:set -DnewVersion=${{ steps.semantic.outputs.new_release_version }} -s ${{ runner.temp }}/settings.xml --no-transfer-progress + git config user.name "GitHub Workflow" + git config user.email "<>" + git add pom.xml + git commit -m "pom.xml updated with new version ${{ steps.semantic.outputs.new_release_version }}" + git push origin main + + # + # Calculation of the new version (again) with tagging + releasing + etc. + # + - name: Calculation of the new version (w/o dry_run) + if: steps.semantic.outputs.new_release_published == 'true' + uses: cycjimmy/semantic-release-action@8e58d20d0f6c8773181f43eb74d6a05e3099571d + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + semantic_version: 19 + branch: main + extra_plugins: | + @semantic-release/release-notes-generator@10.0.3 + @semantic-release/git@10.0.1 + dry_run: false + + # + # Build native executable. + # + - name: Build native executable + if: steps.semantic.outputs.new_release_published == 'true' + run: ${{ runner.temp }}/maven/bin/mvn clean package -Pnative -Dmaven.test.skip=true -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image@sha256:05baf3fd2173f6f25ad35216b6b066c35fbfb97f06daba75efb5b22bc0a85b9c -s ${{ runner.temp }}/settings.xml --no-transfer-progress + + # + # Build Docker image. + # + - name: Build Docker image + if: steps.semantic.outputs.new_release_published == 'true' + run: docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/${{ github.repository }}:latest -t ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} . + + # + # Push Docker image. + # + - name: Push Docker image + if: steps.semantic.outputs.new_release_published == 'true' + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + docker push -a ghcr.io/${{ github.repository }} + + # + # Login to Azure. + # + - name: Login to Azure + if: steps.semantic.outputs.new_release_published == 'true' + uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + # + # Update Container App. + # + - name: Update Container App + if: steps.semantic.outputs.new_release_published == 'true' + uses: azure/CLI@fa0f960f00db49b95fdb54328a767aee31e80105 + with: + inlineScript: | + az config set extension.use_dynamic_install=yes_without_prompt + az containerapp update -n ${{ secrets.AZURE_CONTAINER_APP_NAME }} -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} --image ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4498f82..165d862a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,12 @@ name: Release a new version on: - pull_request: - types: - - closed - branches: - - main + workflow_dispatch: + #pull_request: + # types: + # - closed + # branches: + # - main jobs: release: diff --git a/.releaserc.json b/.releaserc.json index efad0b1d..20031e79 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -3,7 +3,7 @@ "main" ], "ci": false, - "tagFormat": "${version}-RC", + "tagFormat": "${version}", "plugins": [ [ "@semantic-release/commit-analyzer", diff --git a/src/main/java/it/pagopa/swclient/mil/auth/bean/RoleEnum.java b/src/main/java/it/pagopa/swclient/mil/auth/bean/RoleEnum.java index be54d9b4..a6471719 100644 --- a/src/main/java/it/pagopa/swclient/mil/auth/bean/RoleEnum.java +++ b/src/main/java/it/pagopa/swclient/mil/auth/bean/RoleEnum.java @@ -18,12 +18,12 @@ public enum RoleEnum { INSTITUTION_PORTAL("InstitutionPortal"), SERVICE_LIST_REQUESTER("ServiceListRequester"), SLAVE_POS("SlavePos"); - + /* * String value. */ private final String string; - + /** * * @param string @@ -31,7 +31,7 @@ public enum RoleEnum { private RoleEnum(String string) { this.string = string; } - + /** * */ @@ -40,7 +40,7 @@ private RoleEnum(String string) { public String toString() { return string; } - + /** * * @param string diff --git a/src/main/java/it/pagopa/swclient/mil/auth/resource/JwksResource.java b/src/main/java/it/pagopa/swclient/mil/auth/resource/JwksResource.java index 6bf36d35..79e57746 100644 --- a/src/main/java/it/pagopa/swclient/mil/auth/resource/JwksResource.java +++ b/src/main/java/it/pagopa/swclient/mil/auth/resource/JwksResource.java @@ -8,13 +8,11 @@ import static it.pagopa.swclient.mil.auth.ErrorCode.ERROR_SEARCHING_FOR_KEYS; import java.time.Instant; -import java.util.Date; import java.util.List; import java.util.OptionalLong; import io.quarkus.logging.Log; import io.smallrye.mutiny.Uni; -import it.pagopa.swclient.mil.auth.bean.PublicKey; import it.pagopa.swclient.mil.auth.service.KeyFinder; import it.pagopa.swclient.mil.bean.Errors; import jakarta.inject.Inject; @@ -74,9 +72,9 @@ public Uni get() { */ OptionalLong minExp = l.getKeys().stream() .map(k -> k.getExp()) - .mapToLong(e->e) + .mapToLong(e -> e) .min(); - + long maxAge = 0; if (minExp.isPresent()) { /* @@ -84,7 +82,7 @@ public Uni get() { */ maxAge = (minExp.getAsLong() - SKEW - Instant.now().toEpochMilli()) / 1000; // seconds } - + CacheControl cacheControl = new CacheControl(); if (maxAge > 0) { cacheControl.setMaxAge((int) maxAge); diff --git a/src/main/java/it/pagopa/swclient/mil/auth/service/ClientVerifier.java b/src/main/java/it/pagopa/swclient/mil/auth/service/ClientVerifier.java index e5abc559..d806077a 100644 --- a/src/main/java/it/pagopa/swclient/mil/auth/service/ClientVerifier.java +++ b/src/main/java/it/pagopa/swclient/mil/auth/service/ClientVerifier.java @@ -39,7 +39,7 @@ public class ClientVerifier { */ @RestClient AuthDataRepository repository; - + /** * * @param clientId diff --git a/src/test/java/it/pagopa/swclient/mil/auth/resource/RequestValidationTest.java b/src/test/java/it/pagopa/swclient/mil/auth/resource/RequestValidationTest.java index 1089f3bd..71d10018 100644 --- a/src/test/java/it/pagopa/swclient/mil/auth/resource/RequestValidationTest.java +++ b/src/test/java/it/pagopa/swclient/mil/auth/resource/RequestValidationTest.java @@ -70,8 +70,8 @@ void clientCredentials1() { } /** - * scopedMustBeNull(getAccessToken) - */ + * scopedMustBeNull(getAccessToken) + */ @Test void clientCredentials10() { /* @@ -93,8 +93,8 @@ void clientCredentials10() { } /** - * merchantIdMustBeNull(getAccessToken) - */ + * merchantIdMustBeNull(getAccessToken) + */ @Test void clientCredentials2() { /* @@ -122,8 +122,8 @@ void clientCredentials2() { } /** - * terminalIdMustBeNull(getAccessToken) - */ + * terminalIdMustBeNull(getAccessToken) + */ @Test void clientCredentials3() { /* @@ -150,8 +150,8 @@ void clientCredentials3() { } /** - * clientSecretMustNotBeNull(getAccessToken) - */ + * clientSecretMustNotBeNull(getAccessToken) + */ @Test void clientCredentials4() { /* @@ -177,8 +177,8 @@ void clientCredentials4() { } /** - * extTokenMustBeNull(getAccessToken) - */ + * extTokenMustBeNull(getAccessToken) + */ @Test void clientCredentials5() { /* @@ -205,8 +205,8 @@ void clientCredentials5() { } /** - * addDataMustBeNull(getAccessToken) - */ + * addDataMustBeNull(getAccessToken) + */ @Test void clientCredentials6() { /* @@ -232,8 +232,8 @@ void clientCredentials6() { } /** - * refreshTokenMustBeNull(getAccessToken) - */ + * refreshTokenMustBeNull(getAccessToken) + */ @Test void clientCredentials7() { /* @@ -258,8 +258,8 @@ void clientCredentials7() { } /** - * usernameMustBeNull(getAccessToken) - */ + * usernameMustBeNull(getAccessToken) + */ @Test void clientCredentials8() { /* @@ -283,8 +283,8 @@ void clientCredentials8() { } /** - * passwordMustBeNull(getAccessToken) - */ + * passwordMustBeNull(getAccessToken) + */ @Test void clientCredentials9() { /* @@ -1350,7 +1350,7 @@ void poynt8() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - + /** * */ @@ -1379,8 +1379,8 @@ void poynt9() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1407,8 +1407,8 @@ void refreshToken1() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1436,8 +1436,8 @@ void refreshToken2() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1466,8 +1466,8 @@ void refreshToken3() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1497,8 +1497,8 @@ void refreshToken4() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1527,8 +1527,8 @@ void refreshToken5() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1556,8 +1556,8 @@ void refreshToken6() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1584,8 +1584,8 @@ void refreshToken7() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test @@ -1613,8 +1613,8 @@ void refreshToken8() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - - /** + + /** * */ @Test diff --git a/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceTest.java b/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceTest.java index fbea364b..8ece01a2 100644 --- a/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceTest.java +++ b/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceTest.java @@ -123,7 +123,7 @@ class TokenResourceTest { final String salt = "BhPEAxmNsm6JIidDZXl/jwIfuFUFwn/hjfoLnDuYyQEfUMQOrtlOCFljm8IYmN5OmMIh3RddWfNSJEVlRxZjig=="; final String clientSecret = "3674f0e7-d717-44cc-a3bc-5f8f41771fea"; final String clientSecret2 = "fe3490ca-e1dc-4f67-8348-d30f2d7d7169"; - + /** * */ @@ -307,7 +307,7 @@ void createTokenByClientSecretWithErrorSearchingClient1() { .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - + /** * */ @@ -423,7 +423,7 @@ void createTokenByClientSecretWithErrorSearchingRoles2() throws NoSuchAlgorithmE .contentType(MediaType.APPLICATION_JSON) .body("errors", notNullValue()); } - + /** * @throws NoSuchAlgorithmException */ @@ -1677,14 +1677,14 @@ private void setupForCreateTokenByPoyntToken() { merchantId, "NA")) .thenReturn(Uni.createFrom().failure(new WebApplicationException(404))); - + Mockito - .when(authDataRepository.getRoles( - acquirerId, - Channel.POS, - clientId, - "NA", - "NA")) - .thenReturn(item(new Role(acquirerId, Channel.POS, clientId, "NA", "NA", List.of(RoleEnum.NOTICE_PAYER.toString(), RoleEnum.SLAVE_POS.toString())))); + .when(authDataRepository.getRoles( + acquirerId, + Channel.POS, + clientId, + "NA", + "NA")) + .thenReturn(item(new Role(acquirerId, Channel.POS, clientId, "NA", "NA", List.of(RoleEnum.NOTICE_PAYER.toString(), RoleEnum.SLAVE_POS.toString())))); } } \ No newline at end of file diff --git a/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceWithExcOnClientSecrVerTest.java b/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceWithExcOnClientSecrVerTest.java index fe11e2fd..e4a7530e 100644 --- a/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceWithExcOnClientSecrVerTest.java +++ b/src/test/java/it/pagopa/swclient/mil/auth/resource/TokenResourceWithExcOnClientSecrVerTest.java @@ -48,7 +48,7 @@ class TokenResourceWithExcOnClientSecrVerTest { /* * */ - //private static final String clientId = "5254f087-1214-45cd-94ae-fda53c835197"; + // private static final String clientId = "5254f087-1214-45cd-94ae-fda53c835197"; String clientId; private static final String acquirerId = "4585625"; private static final String merchantId = "28405fHfk73x88D"; @@ -63,7 +63,7 @@ class TokenResourceWithExcOnClientSecrVerTest { void generateClientId() { clientId = UUID.randomUUID().toString(); } - + /** * @throws NoSuchAlgorithmException */ diff --git a/src/test/java/it/pagopa/swclient/mil/auth/service/KeyFinderWithExceptionTest.java b/src/test/java/it/pagopa/swclient/mil/auth/service/KeyFinderWithExceptionTest.java index 53602ea2..2393bbb8 100644 --- a/src/test/java/it/pagopa/swclient/mil/auth/service/KeyFinderWithExceptionTest.java +++ b/src/test/java/it/pagopa/swclient/mil/auth/service/KeyFinderWithExceptionTest.java @@ -48,8 +48,10 @@ class KeyFinderWithExceptionTest { KeyPairGenerator keyPairGenerator; /** - * Get key pair but there is no one, so it must be generated but during generation an exception occurs. - * @throws JOSEException + * Get key pair but there is no one, so it must be generated but during generation an exception + * occurs. + * + * @throws JOSEException */ @Test void getKeyPairWithKeyGenerationAndException() throws JOSEException { @@ -63,7 +65,7 @@ void getKeyPairWithKeyGenerationAndException() throws JOSEException { Mockito .when(redisClient.setex(anyString(), anyLong(), any(KeyPair.class))) .thenReturn(Uni.createFrom().voidItem()); - + Mockito .when(keyPairGenerator.generate()) .thenThrow(new JOSEException("synthetic"));