From 00521afd1885ed16ad9c4770db188b89262f1203 Mon Sep 17 00:00:00 2001 From: Achim Rohn Date: Sat, 16 May 2026 12:07:55 +0200 Subject: [PATCH] fix(test): explicit type witness on List.of(Object[]) for Mockito inference javac couldn't infer List from List.of(row) when row is Object[]; adding the explicit type witness List.of(row) resolves the ambiguous overload that caused the compilation error. Co-Authored-By: Claude Sonnet 4.6 --- .../test/java/com/example/app/report/ReportServiceTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/test/java/com/example/app/report/ReportServiceTest.java b/backend/src/test/java/com/example/app/report/ReportServiceTest.java index 2e35b66..5616056 100644 --- a/backend/src/test/java/com/example/app/report/ReportServiceTest.java +++ b/backend/src/test/java/com/example/app/report/ReportServiceTest.java @@ -28,7 +28,8 @@ class ReportServiceTest { LocalDate monday = ReportService.parseIsoWeekToMonday("2026-W20"); 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.of(row)); WeeklyReport report = reportService.weeklyReport(1L, "2026-W20"); @@ -52,7 +53,7 @@ class ReportServiceTest { // budget 60 minutes, logged 90 — breached Object[] row = {1L, "Acme", 60, 100_00, 90L, 120_00L}; when(timeEntryRepository.aggregateByProjectForMonth(anyLong(), anyInt(), anyInt())) - .thenReturn(List.of(row)); + .thenReturn(List.of(row)); var report = reportService.monthlyReport(1L, "2026-05");