1 package com.android.bedstead.nene.properties 2 3 import com.android.bedstead.harrier.BedsteadJUnit4 4 import com.android.bedstead.harrier.DeviceState 5 import com.android.bedstead.nene.TestApis 6 import com.google.common.truth.Truth.assertThat 7 import org.junit.ClassRule 8 import org.junit.Rule 9 import org.junit.Test 10 import org.junit.runner.RunWith 11 12 @RunWith(BedsteadJUnit4::class) 13 class PropertiesTest { 14 15 @Test set_valueIsSetnull16 fun set_valueIsSet() { 17 TestApis.properties().set(KEY, VALUE).use { 18 19 assertThat(TestApis.properties().get(KEY)).isEqualTo(VALUE) 20 } 21 } 22 23 @Test set_autoclose_resetsValuenull24 fun set_autoclose_resetsValue() { 25 TestApis.properties().set(KEY, VALUE).use { 26 TestApis.properties().set(KEY, DIFFERENT_VALUE).use { 27 // Allow to autoclose 28 } 29 30 assertThat(TestApis.properties().get(KEY)).isEqualTo(VALUE) 31 } 32 } 33 34 companion object { 35 @JvmField 36 @ClassRule 37 @Rule 38 val deviceState = DeviceState() 39 40 val KEY = "dumpstate.testkey" 41 42 val VALUE = "value123" 43 44 val DIFFERENT_VALUE = "value234" 45 } 46 47 }