Skip to content

Commit

Permalink
Change type of mock to be more specific than any and remove recundanc…
Browse files Browse the repository at this point in the history
…e in test file
  • Loading branch information
ManuelMoeri committed Jan 30, 2025
1 parent 155faa3 commit 27e8070
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class QuarterControllerIT {
@Test
void shouldGetAllQuarters() throws Exception {
BDDMockito.given(quarterBusinessService.getQuarters()).willReturn(quarterList);
BDDMockito.given(quarterMapper.toDtos(any())).willReturn(quarterDtoList);
BDDMockito.given(quarterMapper.toDtos(quarterList)).willReturn(quarterDtoList);

mvc
.perform(get("/api/v2/quarters").contentType(MediaType.APPLICATION_JSON))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ private static List<Overview> createOverviews() {
return createOverviews(authorizationUser);
}

private static Quarter normalQuarter = Quarter.Builder.builder().withId(QUARTER_ID).withLabel("GJ 22/23-Q2").build();

private static List<Overview> createOverviews(AuthorizationUser authorizationUser) {
long index = 1L;
List<Overview> overviews = new ArrayList<>(List
Expand Down Expand Up @@ -137,8 +139,9 @@ void shouldReturnListOfOverviewsWhenQuarterIsNullUsingGetFilteredOverview() {
when(overviewPersistenceService.getFilteredOverview(QUARTER_ID, teamIds, "", authorizationUser))
.thenReturn(createOverviews());
when(quarterBusinessService.getCurrentQuarter())
.thenReturn(Quarter.Builder.builder().withId(QUARTER_ID).withLabel("GJ 22/23-Q2").build());
when(quarterBusinessService.getQuarterById(any())).thenReturn(Quarter.Builder.builder().withId(QUARTER_ID).withLabel("GJ 22/23-Q2").build());
.thenReturn(normalQuarter);
when(quarterBusinessService.getQuarterById(any()))
.thenReturn(normalQuarter);

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

Expand Down

0 comments on commit 27e8070

Please sign in to comment.