Skip to content

Commit

Permalink
Fix backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Jan 28, 2025
1 parent 5ab90d3 commit cfc3777
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/models/Quarter.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setEndDate(LocalDate endDate) {
}

public boolean isBacklogQuarter() {
return this.label.equals(BACKLOG_QUARTER_LABEL) && this.startDate == null && this.endDate == null;
return Objects.equals(this.label, BACKLOG_QUARTER_LABEL) && this.startDate == null && this.endDate == null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -114,6 +116,7 @@ private static List<Overview> createOverviews(AuthorizationUser authorizationUse
void shouldReturnListOfOverviewsUsingGetFilteredOverview() {
when(overviewPersistenceService.getFilteredOverview(QUARTER_ID, teamIds, "Objective", authorizationUser))
.thenReturn(createOverviews());
when(quarterBusinessService.getQuarterById(any())).thenReturn(new Quarter());

List<Overview> overviews = overviewBusinessService.getFilteredOverview(QUARTER_ID, teamIds, "Objective",
authorizationUser);
Expand All @@ -135,6 +138,7 @@ void shouldReturnListOfOverviewsWhenQuarterIsNullUsingGetFilteredOverview() {
.thenReturn(createOverviews());
when(quarterBusinessService.getCurrentQuarter())
.thenReturn(Quarter.Builder.builder().withId(QUARTER_ID).withLabel("GJ 22/23-Q2").build());
when(quarterBusinessService.getQuarterById(any())).thenReturn(new Quarter());

List<Overview> overviews = overviewBusinessService.getFilteredOverview(null, teamIds, "", authorizationUser);

Expand Down Expand Up @@ -200,6 +204,7 @@ void shouldReturnSortedListWithUserTeamsFirstUsingGetFilteredOverview() {
AuthorizationUser user = mockAuthorizationUser(defaultUser(13L));
when(overviewPersistenceService.getFilteredOverview(QUARTER_ID, teamIds, null, user))
.thenReturn(createOverviews(user));
when(quarterBusinessService.getQuarterById(any())).thenReturn(new Quarter());

List<Overview> overviews = overviewBusinessService.getFilteredOverview(QUARTER_ID, teamIds, null, user);

Expand Down

0 comments on commit cfc3777

Please sign in to comment.