package com.github.kubode.rxproperty

import org.junit.Test
import kotlin.test.assertNull

class EmptyVariableKtTest {

    @Test(expected = NullPointerException::class) fun npeWhenAccessToDefaultValue() {
        val value = emptyVariable<String>().value
        value.length
    }

    @Test fun defaultValueIsNull() {
        val value = emptyVariable<String?>().value
        assertNull(value)
    }

    @Test(expected = Exception::class) fun failSetNullIfNotNullType() {
        emptyVariable<String>().value = Java.getNull()
    }
}

package com.github.kubode.rxproperty

import org.junit.Test
import kotlin.test.assertEquals

class EmptyVariableKtTest {

    @Test(expected = NullPointerException::class) fun npeWhenAccessToDefaultValue() {
        val value = emptyVariable<String>().value
        value.length
    }

    @Test fun setAndGet() {
        val variable = emptyVariable<String>()
        variable.value = ""
        assertEquals("", variable.value)
    }

    @Test(expected = Exception::class) fun failSetNullIfNotNullType() {
        emptyVariable<String>().value = Java.getNull()
    }
}

Add empty variable test case.
Add empty variable test case.

kubode/RxProperty,kubode/RxProperty,kubode/RxProperty