diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerGetHolidayBenchmarkTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerGetHolidayBenchmarkTest.java index a202b234c..00b1e74fa 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerGetHolidayBenchmarkTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerGetHolidayBenchmarkTest.java @@ -34,9 +34,14 @@ public class HolidayManagerGetHolidayBenchmarkTest extends Benchmarks { private static final double REFERENCE_SCORE = 22_000_000.00; + @State(Scope.Thread) + public static class YearState { + public final Year year = Year.of(2010); + } + @Benchmark - public static Set benchmarkGetHolidays(final HolidayManagerState holidayManagerState) { - return holidayManagerState.holidayManager.getHolidays(Year.of(2010)); + public static Set benchmarkGetHolidays(final HolidayManagerState holidayManagerState, final YearState yearState) { + return holidayManagerState.holidayManager.getHolidays(yearState.year); } @Test diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerIsHolidayBenchmarkTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerIsHolidayBenchmarkTest.java index 3ace013f9..0dc1835ec 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerIsHolidayBenchmarkTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayManagerIsHolidayBenchmarkTest.java @@ -37,9 +37,14 @@ public static class HolidayManagerState { public final HolidayManager holidayManager = HolidayManager.getInstance(create("test")); } + @State(Scope.Thread) + public static class LocalDateState { + public final LocalDate localDate = LocalDate.of(2010, 1, 1); + } + @Benchmark - public static boolean benchmarkIsHoliday(final HolidayManagerState holidayManagerState) { - return holidayManagerState.holidayManager.isHoliday(LocalDate.of(2010, 1, 1)); + public static boolean benchmarkIsHoliday(final HolidayManagerState holidayManagerState, final LocalDateState localDateState) { + return holidayManagerState.holidayManager.isHoliday(localDateState.localDate); } @Test