@@ -17,6 +17,7 @@ import kotlinx.coroutines.flow.first
1717import kotlinx.coroutines.test.TestResult
1818import kotlinx.coroutines.withContext
1919import kotlinx.serialization.Serializable
20+ import kotlinx.serialization.builtins.nullable
2021import kotlin.random.Random
2122import kotlin.test.BeforeTest
2223import kotlin.test.Test
@@ -148,7 +149,7 @@ class FirebaseFirestoreTest {
148149
149150 doc.set(FirestoreTimeTest .serializer(), FirestoreTimeTest (" ServerTimestamp" , Timestamp .ServerTimestamp ))
150151
151- assertNotEquals(Timestamp .ServerTimestamp , doc.get().get< BaseTimestamp > (" time" ))
152+ assertNotEquals(Timestamp .ServerTimestamp , doc.get().get(" time" , BaseTimestamp .serializer() ))
152153 assertNotEquals(Timestamp .ServerTimestamp , doc.get().data(FirestoreTimeTest .serializer()).time)
153154 }
154155
@@ -170,7 +171,7 @@ class FirebaseFirestoreTest {
170171
171172 val pendingWritesSnapshot = deferredPendingWritesSnapshot.await()
172173 assertTrue(pendingWritesSnapshot.metadata.hasPendingWrites)
173- assertNull(pendingWritesSnapshot.get< BaseTimestamp ?> (" time" , ServerTimestampBehavior .NONE ))
174+ assertNull(pendingWritesSnapshot.get(" time" , BaseTimestamp .serializer().nullable , ServerTimestampBehavior .NONE ))
174175 }
175176
176177 @Test
@@ -188,7 +189,7 @@ class FirebaseFirestoreTest {
188189
189190 val pendingWritesSnapshot = deferredPendingWritesSnapshot.await()
190191 assertTrue(pendingWritesSnapshot.metadata.hasPendingWrites)
191- assertNotNull(pendingWritesSnapshot.get< BaseTimestamp ?> (" time" , ServerTimestampBehavior .ESTIMATE ))
192+ assertNotNull(pendingWritesSnapshot.get(" time" , BaseTimestamp .serializer().nullable , ServerTimestampBehavior .ESTIMATE ))
192193 assertNotEquals(Timestamp .ServerTimestamp , pendingWritesSnapshot.data(FirestoreTimeTest .serializer(), ServerTimestampBehavior .ESTIMATE ).time)
193194 }
194195
@@ -207,7 +208,7 @@ class FirebaseFirestoreTest {
207208
208209 val pendingWritesSnapshot = deferredPendingWritesSnapshot.await()
209210 assertTrue(pendingWritesSnapshot.metadata.hasPendingWrites)
210- assertNull(pendingWritesSnapshot.get< BaseTimestamp ?> (" time" , ServerTimestampBehavior .PREVIOUS ))
211+ assertNull(pendingWritesSnapshot.get(" time" , BaseTimestamp .serializer().nullable , ServerTimestampBehavior .PREVIOUS ))
211212 }
212213
213214 @Test
@@ -472,9 +473,9 @@ class FirebaseFirestoreTest {
472473
473474 val ms = 12345678.0
474475
475- doc.set(LegacyDocument (time = ms))
476+ doc.set(LegacyDocument .serializer(), LegacyDocument (time = ms))
476477
477- val fetched: NewDocument = doc.get().data()
478+ val fetched: NewDocument = doc.get().data(NewDocument .serializer() )
478479 assertEquals(ms, fetched.time.toMilliseconds())
479480 }
480481
@@ -488,27 +489,27 @@ class FirebaseFirestoreTest {
488489 val collection = Firebase .firestore
489490 .collection(" testQueryByTimestamp" )
490491
491- val timestamp = Timestamp .now( )
492+ val timestamp = Timestamp .fromMilliseconds( 1693262549000.0 )
492493
493494 val pastTimestamp = Timestamp (timestamp.seconds - 60 , 12345000 ) // note: iOS truncates 3 last digits of nanoseconds due to internal conversions
494495 val futureTimestamp = Timestamp (timestamp.seconds + 60 , 78910000 )
495496
496- collection.add(DocumentWithTimestamp (pastTimestamp))
497- collection.add(DocumentWithTimestamp (futureTimestamp))
497+ collection.add(DocumentWithTimestamp .serializer(), DocumentWithTimestamp (pastTimestamp))
498+ collection.add(DocumentWithTimestamp .serializer(), DocumentWithTimestamp (futureTimestamp))
498499
499500 val equalityQueryResult = collection.where(
500501 path = FieldPath (DocumentWithTimestamp ::time.name),
501502 equalTo = pastTimestamp
502- ).get().documents.map { it.data< DocumentWithTimestamp >() }
503+ ).get().documents.map { it.data( DocumentWithTimestamp .serializer()) }.toSet()
503504
504- assertEquals(listOf (DocumentWithTimestamp (pastTimestamp)), equalityQueryResult)
505+ assertEquals(setOf (DocumentWithTimestamp (pastTimestamp)), equalityQueryResult)
505506
506507 val gtQueryResult = collection.where(
507508 path = FieldPath (DocumentWithTimestamp ::time.name),
508509 greaterThan = timestamp
509- ).get().documents.map { it.data< DocumentWithTimestamp >() }
510+ ).get().documents.map { it.data( DocumentWithTimestamp .serializer()) }.toSet()
510511
511- assertEquals(listOf (DocumentWithTimestamp (futureTimestamp)), gtQueryResult)
512+ assertEquals(setOf (DocumentWithTimestamp (futureTimestamp)), gtQueryResult)
512513 }
513514
514515 private suspend fun setupFirestoreData () {
0 commit comments