-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add tests for RemoteFieldConfigDefaults
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...s/src/test/kotlin/org/wordpress/android/processor/RemoteFieldConfigDefaultsBuilderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, Any> = 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<String, String>() | ||
|
||
// 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<String, Any> = mapOf( | ||
) | ||
} | ||
""".trimIndent(), sut.getContent().toString() | ||
) | ||
} | ||
} |