Skip to content

Commit

Permalink
Fix tenant provider function mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Jan 22, 2025
1 parent a7ac03b commit 3ba7eaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import ch.puzzle.okr.test.TestHelper;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Stream;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -124,7 +121,7 @@ void shouldNotGenerateQuarterIfNotLastMonthOfQuarter(int month) {
@ValueSource(ints = { 3, 6, 9, 12 })
void shouldGenerateQuarterIfLastMonthOfQuarter(int month) {
ReflectionTestUtils.setField(quarterBusinessService, "quarterStart", 7);
Mockito.doReturn(List.of(TestHelper.SCHEMA_PITC)).when(tenantConfigProvider).getAllTenantIds();
Mockito.doReturn(Set.of(TestHelper.SCHEMA_PITC)).when(tenantConfigProvider).getAllTenantIds();

Mockito.when(quarterBusinessService.getCurrentYearMonth()).thenReturn(YearMonth.of(2030, month));
quarterBusinessService.scheduledGenerationQuarters();
Expand All @@ -145,7 +142,7 @@ private static Stream<Arguments> generateQuarterParams() {
@MethodSource("generateQuarterParams")
void shouldGenerateCorrectQuarter(int quarterStart, String quarterFormat, YearMonth currentYearMonth,
String expectedLabel) {
Mockito.doReturn(List.of(TestHelper.SCHEMA_PITC)).when(tenantConfigProvider).getAllTenantIds();
Mockito.doReturn(Set.of(TestHelper.SCHEMA_PITC)).when(tenantConfigProvider).getAllTenantIds();

ReflectionTestUtils.setField(quarterBusinessService, "quarterStart", quarterStart);
ReflectionTestUtils.setField(quarterBusinessService, "quarterFormat", quarterFormat);
Expand Down

0 comments on commit 3ba7eaf

Please sign in to comment.