mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-28 03:48:37 +03:00
Replaces mocks with fixtures in fake json adapters
This commit is contained in:
parent
b82efe95bd
commit
d3d99dd3ba
2 changed files with 8 additions and 5 deletions
|
@ -20,18 +20,21 @@ import com.squareup.moshi.JsonAdapter
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import org.matrix.android.sdk.api.auth.data.Credentials
|
import org.matrix.android.sdk.api.auth.data.Credentials
|
||||||
|
import org.matrix.android.sdk.test.fakes.auth.db.sessionparams.FakeSessionParamsMapperMoshi.Companion.sessionParams
|
||||||
|
import org.matrix.android.sdk.test.fakes.auth.db.sessionparams.FakeSessionParamsMapperMoshi.Companion.sessionParamsEntity
|
||||||
|
import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials
|
||||||
|
|
||||||
internal class FakeCredentialsJsonAdapter {
|
internal class FakeCredentialsJsonAdapter {
|
||||||
|
|
||||||
val instance: JsonAdapter<Credentials> = mockk()
|
val instance: JsonAdapter<Credentials> = mockk()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
every { instance.fromJson(FakeSessionParamsMapperMoshi.sessionParamsEntity.credentialsJson) } returns credentials
|
every { instance.fromJson(sessionParamsEntity.credentialsJson) } returns credentials
|
||||||
every { instance.toJson(FakeSessionParamsMapperMoshi.sessionParams.credentials) } returns CREDENTIALS_JSON
|
every { instance.toJson(sessionParams.credentials) } returns CREDENTIALS_JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
fun givenNullDeserialization() {
|
fun givenNullDeserialization() {
|
||||||
every { instance.fromJson(FakeSessionParamsMapperMoshi.sessionParamsEntity.credentialsJson) } returns null
|
every { instance.fromJson(sessionParamsEntity.credentialsJson) } returns null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun givenNullSerialization() {
|
fun givenNullSerialization() {
|
||||||
|
@ -39,7 +42,7 @@ internal class FakeCredentialsJsonAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val credentials: Credentials = mockk()
|
val credentials = aCredentials()
|
||||||
const val CREDENTIALS_JSON = "credentials_json"
|
const val CREDENTIALS_JSON = "credentials_json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ internal class FakeHomeServerConnectionConfigJsonAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val homeServerConnectionConfig: HomeServerConnectionConfig = mockk()
|
val homeServerConnectionConfig = HomeServerConnectionConfig.Builder().build()
|
||||||
const val HOME_SERVER_CONNECTION_CONFIG_JSON = "home_server_connection_config_json"
|
const val HOME_SERVER_CONNECTION_CONFIG_JSON = "home_server_connection_config_json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue