diff --git a/libs/processors/src/test/kotlin/org/wordpress/android/processor/RemoteFieldConfigDefaultsBuilderTest.kt b/libs/processors/src/test/kotlin/org/wordpress/android/processor/RemoteFieldConfigDefaultsBuilderTest.kt new file mode 100644 index 000000000000..a3d0d19dba38 --- /dev/null +++ b/libs/processors/src/test/kotlin/org/wordpress/android/processor/RemoteFieldConfigDefaultsBuilderTest.kt @@ -0,0 +1,66 @@ +package org.wordpress.android.processor + +import org.junit.Assert.* +import org.junit.Test + +class RemoteFieldConfigDefaultsBuilderTest { + + @Test + fun `given a list of remote fields, when building the object, then generate list of remote fields`() { + // given + val keyA = "keyA" + val valueA = "valueA" + val keyB = "keyB" + val valueB = "valueB" + + // when + val sut = RemoteFieldConfigDefaultsBuilder(mapOf(keyA to valueA, keyB to valueB)) + + // then + assertEquals( + """ + // Automatically generated file. DO NOT MODIFY + package org.wordpress.android.util.config + + import kotlin.Any + import kotlin.String + import kotlin.collections.Map + + object RemoteFieldConfigDefaults { + val remoteFieldConfigDefaults: Map = mapOf( + "$keyA" to "$valueA", + "$keyB" to "$valueB" + ) + } + + """.trimIndent(), sut.getContent().toString() + ) + } + + @Test + fun `given an empty list of remote fields, when building the object, then generate empty list of remote fields`() { + // given + val remoteFields = emptyMap() + + // when + val sut = RemoteFieldConfigDefaultsBuilder(remoteFields) + + // then + assertEquals( + """ + // Automatically generated file. DO NOT MODIFY + package org.wordpress.android.util.config + + import kotlin.Any + import kotlin.String + import kotlin.collections.Map + + object RemoteFieldConfigDefaults { + val remoteFieldConfigDefaults: Map = mapOf( + ) + } + + """.trimIndent(), sut.getContent().toString() + ) + } +}