diff --git a/ground/src/test/java/com/google/android/ground/persistence/remote/firebase/schema/LoiLocalDataStoreConverterTest.kt b/ground/src/test/java/com/google/android/ground/persistence/remote/firebase/schema/LoiLocalDataStoreConverterTest.kt index 436edf5151..a01ee7b684 100644 --- a/ground/src/test/java/com/google/android/ground/persistence/remote/firebase/schema/LoiLocalDataStoreConverterTest.kt +++ b/ground/src/test/java/com/google/android/ground/persistence/remote/firebase/schema/LoiLocalDataStoreConverterTest.kt @@ -58,13 +58,13 @@ class LoiLocalDataStoreConverterTest { mockLoiDocumentSnapshot( "loi001", LoiDocument( - /* jobId */ "job001", - /* customId */null, - /* location */ null, - /* geoJson */ null, - /* geometry */ null, - /* created */ AUDIT_INFO_1_NESTED_OBJECT, - /* lastModified */ AUDIT_INFO_2_NESTED_OBJECT + /* jobId */ "job001", + /* customId */ null, + /* location */ null, + /* geoJson */ null, + /* geometry */ null, + /* created */ AUDIT_INFO_1_NESTED_OBJECT, + /* lastModified */ AUDIT_INFO_2_NESTED_OBJECT ) ) assertThat(toLocationOfInterest().isFailure).isTrue() diff --git a/ground/src/test/java/com/google/android/ground/repository/LocationOfInterestRepositoryTest.kt b/ground/src/test/java/com/google/android/ground/repository/LocationOfInterestRepositoryTest.kt index 3eb65c97c6..8c5f624bca 100644 --- a/ground/src/test/java/com/google/android/ground/repository/LocationOfInterestRepositoryTest.kt +++ b/ground/src/test/java/com/google/android/ground/repository/LocationOfInterestRepositoryTest.kt @@ -73,7 +73,7 @@ class LocationOfInterestRepositoryTest : BaseHiltTest() { // TODO(#1559): Remove once customId and caption are handled consistently. val loi = LOCATION_OF_INTEREST.copy( - customId = null, + customId = "", // TODO(#1562): Remove once creation time is preserved in local db. lastModified = LOCATION_OF_INTEREST.created ) @@ -194,7 +194,7 @@ class LocationOfInterestRepositoryTest : BaseHiltTest() { id = id, geometry = Point(coordinate), surveyId = TEST_SURVEY.id, - customId = null + customId = "" ) private fun createPolygon(id: String, coordinates: List) = @@ -202,7 +202,7 @@ class LocationOfInterestRepositoryTest : BaseHiltTest() { id = id, geometry = Polygon(LinearRing(coordinates)), surveyId = TEST_SURVEY.id, - customId = null + customId = "" ) } } diff --git a/ground/src/test/java/com/google/android/ground/ui/common/LocationOfInterestHelperTest.kt b/ground/src/test/java/com/google/android/ground/ui/common/LocationOfInterestHelperTest.kt index e090458df0..0bc526cea5 100644 --- a/ground/src/test/java/com/google/android/ground/ui/common/LocationOfInterestHelperTest.kt +++ b/ground/src/test/java/com/google/android/ground/ui/common/LocationOfInterestHelperTest.kt @@ -58,7 +58,7 @@ class LocationOfInterestHelperTest : BaseHiltTest() { @Test fun testGetLabel_whenCaptionIsEmptyAndLoiIsPolygon() { - val loi = FakeData.AREA_OF_INTEREST.copy( "") + val loi = FakeData.AREA_OF_INTEREST.copy("") assertLabel(loi, "Polygon") } diff --git a/ground/src/test/java/com/google/android/ground/ui/home/mapcontainer/LoiCardUtilTest.kt b/ground/src/test/java/com/google/android/ground/ui/home/mapcontainer/LoiCardUtilTest.kt index d5791c1a72..ecccb9a8a2 100644 --- a/ground/src/test/java/com/google/android/ground/ui/home/mapcontainer/LoiCardUtilTest.kt +++ b/ground/src/test/java/com/google/android/ground/ui/home/mapcontainer/LoiCardUtilTest.kt @@ -33,12 +33,14 @@ class LoiCardUtilTest { @Test fun testLoiNameWithPoint_whenCustomIdAndPropertiesAreNull() { - assertThat(getDisplayLoiName(context, TEST_LOI.copy(customId = null, properties = null))).isEqualTo("Unnamed point") + assertThat(getDisplayLoiName(context, TEST_LOI.copy(customId = "", properties = mapOf()))) + .isEqualTo("Unnamed point") } @Test fun testLoiNameWithPolygon_whenCustomIdAndPropertiesAreNull() { - assertThat(getDisplayLoiName(context, TEST_AREA.copy(customId = null, properties = null))).isEqualTo("Unnamed area") + assertThat(getDisplayLoiName(context, TEST_AREA.copy(customId = "", properties = mapOf()))) + .isEqualTo("Unnamed area") } @Test @@ -55,25 +57,42 @@ class LoiCardUtilTest { @Test fun testArea_whenCustomIdIsNotAvailable_usesPropertiesId() { - assertThat(getDisplayLoiName(context, TEST_AREA.copy(customId = null, properties = mapOf("id" to "property id")))) + assertThat( + getDisplayLoiName( + context, + TEST_AREA.copy(customId = "", properties = mapOf("id" to "property id")) + ) + ) .isEqualTo("Area (property id)") } @Test fun testLoiName_whenPropertiesNameIsAvailable() { - assertThat(getDisplayLoiName(context, TEST_LOI.copy(properties = mapOf("name" to "custom name")))) + assertThat( + getDisplayLoiName(context, TEST_LOI.copy(properties = mapOf("name" to "custom name"))) + ) .isEqualTo("custom name") } @Test fun testLoiName_whenCustomIdAndPropertiesNameIsAvailable() { - assertThat(getDisplayLoiName(context, TEST_LOI.copy(customId = "some value",properties = mapOf("name" to "custom name") ))) + assertThat( + getDisplayLoiName( + context, + TEST_LOI.copy(customId = "some value", properties = mapOf("name" to "custom name")) + ) + ) .isEqualTo("custom name (some value)") } @Test fun testLoiName_whenPropertiesDoesNotContainName() { - assertThat(getDisplayLoiName(context, TEST_LOI.copy(customId = null, properties = mapOf("not" to "a name field")))) + assertThat( + getDisplayLoiName( + context, + TEST_LOI.copy(customId = "", properties = mapOf("not" to "a name field")) + ) + ) .isEqualTo("Unnamed point") } diff --git a/sharedTest/src/main/kotlin/com/sharedtest/FakeData.kt b/sharedTest/src/main/kotlin/com/sharedtest/FakeData.kt index 3d9cd8557e..8e773d8b1b 100644 --- a/sharedTest/src/main/kotlin/com/sharedtest/FakeData.kt +++ b/sharedTest/src/main/kotlin/com/sharedtest/FakeData.kt @@ -60,7 +60,7 @@ object FakeData { "loi id", SURVEY.id, JOB, - customId = null, + customId = "", created = AuditInfo(USER), lastModified = AuditInfo(USER), geometry = Point(Coordinates(0.0, 0.0)),