From e85cf0f11c289af1e929b784370b1c4a5d32196e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:26:36 +0000 Subject: [PATCH 1/4] Update dependency net.revelc.code.formatter:formatter-maven-plugin to v2.24.1 --- backend/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/pom.xml b/backend/pom.xml index 492da5166e..591fe52c10 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -229,7 +229,7 @@ net.revelc.code.formatter formatter-maven-plugin - 2.23.0 + 2.24.1 ${maven.compiler.source} ${maven.compiler.source} From ae61af391b285744ad0505c7e145fffd1c4e82e1 Mon Sep 17 00:00:00 2001 From: Jannik Pulfer Date: Mon, 21 Oct 2024 14:31:03 +0200 Subject: [PATCH 2/4] Format code --- .../OverviewAuthorizationServiceTest.java | 3 ++- .../authorization/TeamAuthorizationServiceTest.java | 8 ++++---- .../AlignmentSelectionBusinessServiceTest.java | 10 ++++------ .../validation/KeyResultValidationServiceTest.java | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/backend/src/test/java/ch/puzzle/okr/service/authorization/OverviewAuthorizationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/authorization/OverviewAuthorizationServiceTest.java index 5a3e6c732c..e2ced700f8 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/authorization/OverviewAuthorizationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/authorization/OverviewAuthorizationServiceTest.java @@ -136,7 +136,8 @@ void getFilteredOverviewShouldSetWritableProperlyToFalse() { @Test void getFilteredOverviewShouldReturnEmptyListWhenNotAuthorized() { when(authorizationService.updateOrAddAuthorizationUser()).thenReturn(authorizationUser); - when(overviewBusinessService.getFilteredOverview(1L, List.of(adminTeamId), "", authorizationUser)).thenReturn(List.of()); + when(overviewBusinessService.getFilteredOverview(1L, List.of(adminTeamId), "", authorizationUser)) + .thenReturn(List.of()); List overviews = overviewAuthorizationService.getFilteredOverview(1L, List.of(adminTeamId), ""); assertThat(List.of()).hasSameElementsAs(overviews); diff --git a/backend/src/test/java/ch/puzzle/okr/service/authorization/TeamAuthorizationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/authorization/TeamAuthorizationServiceTest.java index 16b7a8d1a1..09243f4aac 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/authorization/TeamAuthorizationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/authorization/TeamAuthorizationServiceTest.java @@ -43,7 +43,8 @@ class TeamAuthorizationServiceTest { @Test void createEntityShouldReturnTeam() { - when(teamBusinessService.createTeam(teamUnderTest, authorizationService.updateOrAddAuthorizationUser())).thenReturn(teamUnderTest); + when(teamBusinessService.createTeam(teamUnderTest, authorizationService.updateOrAddAuthorizationUser())) + .thenReturn(teamUnderTest); Team team = teamAuthorizationService.createEntity(teamUnderTest); assertEquals(teamUnderTest, team); @@ -140,9 +141,8 @@ void getAllTeamsShouldReturnAllTeams(boolean isWriteable) { @Test void addUsersToTeam_shouldThrowExceptionIfUserNotAuthorized() { - when(authorizationService.updateOrAddAuthorizationUser()).thenReturn( - new AuthorizationUser(defaultUserWithTeams(1L, List.of(), List.of())) - ); + when(authorizationService.updateOrAddAuthorizationUser()) + .thenReturn(new AuthorizationUser(defaultUserWithTeams(1L, List.of(), List.of()))); assertThrows(OkrResponseStatusException.class, () -> teamAuthorizationService.addUsersToTeam(1L, List.of())); } diff --git a/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java index 91257a4974..29b57b5aed 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java @@ -31,13 +31,11 @@ private static AlignmentSelection createAlignmentSelection() { @Test void getAlignmentSelectionByQuarterIdAndTeamIdNotShouldReturnListOfAlignmentSelections() { - when(alignmentSelectionPersistenceService.getAlignmentSelectionByQuarterIdAndTeamIdNot(2L, - 4L)).thenReturn(List.of( - createAlignmentSelection())); + when(alignmentSelectionPersistenceService.getAlignmentSelectionByQuarterIdAndTeamIdNot(2L, 4L)) + .thenReturn(List.of(createAlignmentSelection())); - List alignmentSelections = alignmentSelectionBusinessService.getAlignmentSelectionByQuarterIdAndTeamIdNot( - 2L, - 4L); + List alignmentSelections = alignmentSelectionBusinessService + .getAlignmentSelectionByQuarterIdAndTeamIdNot(2L, 4L); assertEquals(1, alignmentSelections.size()); verify(alignmentSelectionPersistenceService, times(1)).getAlignmentSelectionByQuarterIdAndTeamIdNot(2L, 4L); diff --git a/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java index c4382a5ab6..5eaa2aa827 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java @@ -64,7 +64,7 @@ void setUp() { when(keyResultPersistenceService.getModelName()).thenReturn("KeyResult"); doThrow(new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("%s with id %s not found", keyResultPersistenceService.getModelName(), 2L))) - .when(keyResultPersistenceService).findById(2L); + .when(keyResultPersistenceService).findById(2L); } @Spy From c64f83a1e047dbe7eabee7db47b8fd5293b2b6f6 Mon Sep 17 00:00:00 2001 From: Jannik Pulfer Date: Mon, 21 Oct 2024 14:58:09 +0200 Subject: [PATCH 3/4] Bump java version from 17 to 21 in formatter action --- .github/workflows/format-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format-action.yml b/.github/workflows/format-action.yml index 6d65711077..ab65881184 100644 --- a/.github/workflows/format-action.yml +++ b/.github/workflows/format-action.yml @@ -52,7 +52,7 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github settings-path: ${{github.workspace}} From 3075c7d0ecc734d7ae555fa4951a32aed12fbea4 Mon Sep 17 00:00:00 2001 From: Jannik Pulfer Date: Mon, 21 Oct 2024 14:59:41 +0200 Subject: [PATCH 4/4] Go back to java 17 and move setting up of java before formatting --- .github/workflows/format-action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/format-action.yml b/.github/workflows/format-action.yml index ab65881184..a6d5452b66 100644 --- a/.github/workflows/format-action.yml +++ b/.github/workflows/format-action.yml @@ -46,17 +46,17 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Format backend - run: mvn formatter:format -f backend/pom.xml - - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: '17' distribution: 'adopt' server-id: github settings-path: ${{github.workspace}} + - name: Format backend + run: mvn formatter:format -f backend/pom.xml + - name: Commit and Push formated backend shell: bash env: