TestFieldMapperSerde.kt 750 Bytes
Newer Older
Jonas Waeber's avatar
Jonas Waeber committed
1
2
package ch.memobase.test

Jonas Waeber's avatar
Jonas Waeber committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import ch.memobase.mapping.fields.ConstantField
import ch.memobase.mapping.mappers.ConstantFieldMapper
import com.beust.klaxon.Klaxon
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestFieldMapperSerde {

    private val klaxon = Klaxon()

    @Test
    fun `test constant field mapper serialization`() {
        val json = klaxon.toJsonString(ConstantFieldMapper(ConstantField("key", "value")))
        val parsed = klaxon.parse<ConstantFieldMapper>(json)
        assertThat(parsed)
            .isNotNull
            .isEqualTo(ConstantFieldMapper(ConstantField("key", "value")))
    }
}