fix(test): explicit type witness on List.of(Object[]) for Mockito inference
javac couldn't infer List<Object[]> from List.of(row) when row is Object[]; adding the explicit type witness List.<Object[]>of(row) resolves the ambiguous overload that caused the compilation error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,8 @@ class ReportServiceTest {
|
|||||||
LocalDate monday = ReportService.parseIsoWeekToMonday("2026-W20");
|
LocalDate monday = ReportService.parseIsoWeekToMonday("2026-W20");
|
||||||
Object[] row = {Date.valueOf(monday), 120L, 9600L}; // 2h, 96.00 EUR
|
Object[] row = {Date.valueOf(monday), 120L, 9600L}; // 2h, 96.00 EUR
|
||||||
|
|
||||||
when(timeEntryRepository.aggregateByDay(anyLong(), any(), any())).thenReturn(List.of(row));
|
when(timeEntryRepository.aggregateByDay(anyLong(), any(), any()))
|
||||||
|
.thenReturn(List.<Object[]>of(row));
|
||||||
|
|
||||||
WeeklyReport report = reportService.weeklyReport(1L, "2026-W20");
|
WeeklyReport report = reportService.weeklyReport(1L, "2026-W20");
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ class ReportServiceTest {
|
|||||||
// budget 60 minutes, logged 90 — breached
|
// budget 60 minutes, logged 90 — breached
|
||||||
Object[] row = {1L, "Acme", 60, 100_00, 90L, 120_00L};
|
Object[] row = {1L, "Acme", 60, 100_00, 90L, 120_00L};
|
||||||
when(timeEntryRepository.aggregateByProjectForMonth(anyLong(), anyInt(), anyInt()))
|
when(timeEntryRepository.aggregateByProjectForMonth(anyLong(), anyInt(), anyInt()))
|
||||||
.thenReturn(List.of(row));
|
.thenReturn(List.<Object[]>of(row));
|
||||||
|
|
||||||
var report = reportService.monthlyReport(1L, "2026-05");
|
var report = reportService.monthlyReport(1L, "2026-05");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user