From 7f6248123c5ff2a4ad23d597f0b85214afdd0e07 Mon Sep 17 00:00:00 2001 From: "Alinson S. Xavier" Date: Thu, 4 Apr 2024 21:55:01 -0500 Subject: [PATCH] DateUtilsTest: Simplify getCalendarUTC --- .../java/org/isoron/uhabits/core/utils/DateUtilsTest.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt b/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt index 2834bcfc4..8969e414f 100644 --- a/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt +++ b/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt @@ -120,11 +120,10 @@ class DateUtilsTest : BaseUnitTest() { @Test fun getWeekdaysInMonth() { - fun getCalendarUTC(year: Int, month: Int, dayOfMonth: Int): GregorianCalendar { - val gregCalendar = GregorianCalendar(year, month, dayOfMonth) - gregCalendar.timeZone = TimeZone.getTimeZone("UTC") - return gregCalendar - } + fun getCalendarUTC(year: Int, month: Int, dayOfMonth: Int) = + GregorianCalendar(year, month, dayOfMonth).apply { + timeZone = TimeZone.getTimeZone("UTC") + } val february = getCalendarUTC(2018, Calendar.FEBRUARY, 1) val leapFebruary = getCalendarUTC(2020, Calendar.FEBRUARY, 1)