Skip to content

Commit 8addb04

Browse files
committed
Remove unused test helper functions related to java.util.Date
1 parent 76528b2 commit 8addb04

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

firebase-dataconnect/testutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/DateTimeTestUtils.kt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,10 @@ package com.google.firebase.dataconnect.testutil
1818

1919
import com.google.firebase.Timestamp
2020
import java.util.Calendar
21-
import java.util.Date
2221
import java.util.GregorianCalendar
2322
import java.util.TimeZone
2423
import kotlin.random.Random
2524

26-
/**
27-
* Creates and returns a new [Date] object that represents the given year, month, and day in UTC.
28-
*
29-
* @param year The year; must be between 0 and 9999, inclusive.
30-
* @param month The month; must be between 1 and 12, inclusive.
31-
* @param day The day of the month; must be between 1 and 31, inclusive.
32-
*/
33-
fun dateFromYearMonthDayUTC(year: Int, month: Int, day: Int): Date {
34-
require(year in 0..9999) { "year must be between 0 and 9999, inclusive" }
35-
require(month in 1..12) { "month must be between 1 and 12, inclusive" }
36-
require(day in 1..31) { "day must be between 1 and 31, inclusive" }
37-
38-
return GregorianCalendar(TimeZone.getTimeZone("UTC"))
39-
.apply {
40-
set(year, month - 1, day, 0, 0, 0)
41-
set(Calendar.MILLISECOND, 0)
42-
}
43-
.time
44-
}
45-
4625
/** Generates and returns a random [Timestamp] object. */
4726
fun randomTimestamp(): Timestamp {
4827
val nanoseconds = Random.nextInt(1_000_000_000)

firebase-dataconnect/testutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/property/arbitrary/dates.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package com.google.firebase.dataconnect.testutil.property.arbitrary
2020

2121
import com.google.firebase.dataconnect.LocalDate
2222
import com.google.firebase.dataconnect.testutil.NullableReference
23-
import com.google.firebase.dataconnect.testutil.dateFromYearMonthDayUTC
2423
import com.google.firebase.dataconnect.testutil.dayRangeInYear
2524
import com.google.firebase.dataconnect.testutil.property.arbitrary.DateEdgeCases.MAX_YEAR
2625
import com.google.firebase.dataconnect.testutil.property.arbitrary.DateEdgeCases.MIN_YEAR
@@ -102,9 +101,6 @@ data class DateTestData(
102101
val string: String,
103102
)
104103

105-
fun DateTestData.toJavaUtilDate(): java.util.Date =
106-
dateFromYearMonthDayUTC(year = date.year, month = date.month, day = date.day)
107-
108104
@Suppress("MemberVisibilityCanBePrivate")
109105
object DateEdgeCases {
110106
// See https://en.wikipedia.org/wiki/ISO_8601#Years for rationale of lower bound of 1583.

0 commit comments

Comments
 (0)