diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverter.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverter.kt index 0c1d5b7db..149c738b7 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverter.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverter.kt @@ -10,7 +10,7 @@ import java.time.ZonedDateTime * A [TypeConverter] to convert a [ZonedDateTime] to and from a [Long]. */ @ProvidedTypeConverter -object ZonedDateTimeTypeConverter { +class ZonedDateTimeTypeConverter { /** * A [TypeConverter] to convert a [Long] to a [ZonedDateTime]. */ diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/di/VaultDiskModule.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/di/VaultDiskModule.kt index 10ddc9d06..b9a4769ff 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/di/VaultDiskModule.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/di/VaultDiskModule.kt @@ -32,7 +32,7 @@ class VaultDiskModule { klass = VaultDatabase::class.java, name = "vault_database", ) - .addTypeConverter(ZonedDateTimeTypeConverter) + .addTypeConverter(ZonedDateTimeTypeConverter()) .build() @Provides diff --git a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverterTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverterTest.kt index 8d937709a..4463aa3db 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverterTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/disk/convertor/ZonedDateTimeTypeConverterTest.kt @@ -7,11 +7,13 @@ import java.time.ZonedDateTime class ZonedDateTimeTypeConverterTest { + private val typeConverter = ZonedDateTimeTypeConverter() + @Test fun `fromTimestamp should return null when value is null`() { val value: Long? = null - val result = ZonedDateTimeTypeConverter.fromTimestamp(value) + val result = typeConverter.fromTimestamp(value) assertNull(result) } @@ -21,7 +23,7 @@ class ZonedDateTimeTypeConverterTest { val expected = ZonedDateTime.parse("2023-12-15T20:38:06Z") val value = expected.toEpochSecond() - val result = ZonedDateTimeTypeConverter.fromTimestamp(value) + val result = typeConverter.fromTimestamp(value) assertEquals(expected, result) } @@ -30,7 +32,7 @@ class ZonedDateTimeTypeConverterTest { fun `toTimestamp should return null when value is null`() { val value: ZonedDateTime? = null - val result = ZonedDateTimeTypeConverter.toTimestamp(value) + val result = typeConverter.toTimestamp(value) assertNull(result) } @@ -40,7 +42,7 @@ class ZonedDateTimeTypeConverterTest { val value = ZonedDateTime.parse("2023-12-15T20:38:06Z") val expected = value.toEpochSecond() - val result = ZonedDateTimeTypeConverter.toTimestamp(value) + val result = typeConverter.toTimestamp(value) assertEquals(expected, result) }