@@ -861,12 +861,16 @@ class DVCClientTests {
861861 val client = createClient(" pretend-its-a-real-sdk-key" , mockWebServer.url(" /" ).toString())
862862
863863 val variable = client.variable(" activate-flag" , " Not activated" )
864+ val varValue = client.variableValue(" activate-flag" , " Not activated" )
864865 val variable2 = client.variable(" activate-flag" , " Activated" )
866+ val varValue2 = client.variableValue(" activate-flag" , " Activated" )
865867
866868 assert (variable != = variable2)
867869 assert (variable.value == = " Not activated" )
870+ assert (varValue == = " Not activated" )
868871 assert (variable.isDefaulted == true )
869872 assert (variable2.value == = " Activated" )
873+ assert (varValue2 == = " Activated" )
870874 assert (variable2.isDefaulted == true )
871875 }
872876
@@ -909,9 +913,14 @@ class DVCClientTests {
909913 val client = createClient(" pretend-its-a-real-sdk-key" , mockWebServer.url(" /" ).toString())
910914
911915 val jsonVar = client.variable(" test-feature-json" , defaultJSON)
916+ val jsonValue = client.variableValue(" test-feature-json" , defaultJSON)
912917 val boolVar = client.variable(" test-feature" , false )
918+ val boolValue = client.variableValue(" test-feature" , false )
913919 val numVar = client.variable(" test-feature-number" , 0 )
920+ val numValue = client.variableValue(" test-feature-number" , 0 )
914921 val strVar = client.variable(" test-feature-string" , " Not activated" )
922+ val strValue = client.variableValue(" test-feature-string" , " Not activated" )
923+
915924 try {
916925 client.onInitialized(object : DVCCallback <String > {
917926 override fun onSuccess (result : String ) {
@@ -932,17 +941,25 @@ class DVCClientTests {
932941
933942 assert (boolVar.value)
934943 assert (boolVar.isDefaulted == false )
944+ // value doesn't get updated
945+ assert (! boolValue)
935946
936947 assert (numVar.value == 42 )
937948 assert (numVar.isDefaulted == false )
949+ // value doesn't get updated
950+ assert (numValue == 0 )
938951
939952 assert (strVar.value == " it works!" )
940953 assert (strVar.isDefaulted == false )
954+ // value doesn't get updated
955+ assert (strValue == " Not activated" )
941956
942957 val expectedJSON = JSONObject ()
943958 expectedJSON.put(" test" , " feature" )
944959 assert (jsonVar.value.toString() == expectedJSON.toString())
945960 assert (jsonVar.isDefaulted == false )
961+ // value doesn't get updated
962+ assert (jsonValue.toString() != = expectedJSON.toString())
946963 }
947964 }
948965
@@ -983,9 +1000,14 @@ class DVCClientTests {
9831000 val client = createClient(" pretend-its-a-real-sdk-key" , mockWebServer.url(" /" ).toString())
9841001
9851002 val jsonVar = client.variable(" test-feature-json" , defaultJSON)
1003+ val jsonValue = client.variableValue(" test-feature-json" , defaultJSON)
9861004 val boolVar = client.variable(" test-feature" , false )
1005+ val boolValue = client.variableValue(" test-feature" , false )
9871006 val numVar = client.variable(" test-feature-number" , 0 )
1007+ val numValue = client.variableValue(" test-feature-number" , 0 )
9881008 val strVar = client.variable(" test-feature-string" , " Not activated" )
1009+ val strValue = client.variableValue(" test-feature-string" , " Not activated" )
1010+
9891011 try {
9901012 client.onInitialized(object : DVCCallback <String > {
9911013 override fun onSuccess (result : String ) {
@@ -1007,15 +1029,19 @@ class DVCClientTests {
10071029 // Expect Client to have failed to initialize, all variables default
10081030 assert (! boolVar.value)
10091031 assert (boolVar.isDefaulted == true )
1032+ assert (! boolValue)
10101033
10111034 assert (numVar.value == 0 )
10121035 assert (numVar.isDefaulted == true )
1036+ assert (numValue == 0 )
10131037
10141038 assert (strVar.value == " Not activated" )
10151039 assert (strVar.isDefaulted == true )
1040+ assert (strValue == " Not activated" )
10161041
10171042 assert (jsonVar.value.toString() == defaultJSON.toString())
10181043 assert (jsonVar.isDefaulted == true )
1044+ assert (jsonValue.toString() == defaultJSON.toString())
10191045 }
10201046 }
10211047
@@ -1056,9 +1082,14 @@ class DVCClientTests {
10561082 val client = createClient(" pretend-its-a-real-sdk-key" , mockWebServer.url(" /" ).toString())
10571083
10581084 val jsonVar = client.variable(" test-feature-json" , defaultJSON)
1085+ val jsonValue = client.variableValue(" test-feature-json" , defaultJSON)
10591086 val boolVar = client.variable(" test-feature" , false )
1087+ val boolValue = client.variableValue(" test-feature" , false )
10601088 val numVar = client.variable(" test-feature-number" , 0 )
1089+ val numValue = client.variableValue(" test-feature-number" , 0 )
10611090 val strVar = client.variable(" test-feature-string" , " Not activated" )
1091+ val strValue = client.variableValue(" test-feature-string" , " Not activated" )
1092+
10621093 try {
10631094 client.onInitialized(object : DVCCallback <String > {
10641095 override fun onSuccess (result : String ) {
@@ -1080,15 +1111,19 @@ class DVCClientTests {
10801111 // Expect Client to have failed to initialize, all variables default
10811112 assert (! boolVar.value)
10821113 assert (boolVar.isDefaulted == true )
1114+ assert (! boolValue)
10831115
10841116 assert (numVar.value == 0 )
10851117 assert (numVar.isDefaulted == true )
1118+ assert (numValue == 0 )
10861119
10871120 assert (strVar.value == " Not activated" )
10881121 assert (strVar.isDefaulted == true )
1122+ assert (strValue == " Not activated" )
10891123
10901124 assert (jsonVar.value.toString() == defaultJSON.toString())
10911125 assert (jsonVar.isDefaulted == true )
1126+ assert (jsonValue.toString() == defaultJSON.toString())
10921127 }
10931128 }
10941129
@@ -1130,9 +1165,14 @@ class DVCClientTests {
11301165 val client = createClient(" pretend-its-a-real-sdk-key" , mockWebServer.url(" /" ).toString())
11311166
11321167 val jsonVar = client.variable(" test-feature-json" , defaultJSON)
1168+ val jsonValue = client.variableValue(" test-feature-json" , defaultJSON)
11331169 val boolVar = client.variable(" test-feature" , false )
1170+ val boolValue = client.variableValue(" test-feature" , false )
11341171 val numVar = client.variable(" test-feature-number" , 0 )
1172+ val numValue = client.variableValue(" test-feature-number" , 0 )
11351173 val strVar = client.variable(" test-feature-string" , " Not activated" )
1174+ val strValue = client.variableValue(" test-feature-string" , " Not activated" )
1175+
11361176 try {
11371177 client.onInitialized(object : DVCCallback <String > {
11381178 override fun onSuccess (result : String ) {
@@ -1154,15 +1194,19 @@ class DVCClientTests {
11541194 // Expect Client to have failed to initialize, all variables default
11551195 assert (! boolVar.value)
11561196 assert (boolVar.isDefaulted == true )
1197+ assert (! boolValue)
11571198
11581199 assert (numVar.value == 0 )
11591200 assert (numVar.isDefaulted == true )
1201+ assert (numValue == 0 )
11601202
11611203 assert (strVar.value == " Not activated" )
11621204 assert (strVar.isDefaulted == true )
1205+ assert (strValue == " Not activated" )
11631206
11641207 assert (jsonVar.value.toString() == defaultJSON.toString())
11651208 assert (jsonVar.isDefaulted == true )
1209+ assert (jsonValue.toString() == defaultJSON.toString())
11661210 }
11671211 }
11681212
@@ -1204,9 +1248,14 @@ class DVCClientTests {
12041248 val client = createClient(" pretend-its-a-real-sdk-key" , mockWebServer.url(" /" ).toString())
12051249
12061250 val jsonVar = client.variable(" test-feature-json" , defaultJSON)
1251+ val jsonValue = client.variableValue(" test-feature-json" , defaultJSON)
12071252 val boolVar = client.variable(" test-feature" , false )
1253+ val boolValue = client.variableValue(" test-feature" , false )
12081254 val numVar = client.variable(" test-feature-number" , 0 )
1255+ val numValue = client.variableValue(" test-feature-number" , 0 )
12091256 val strVar = client.variable(" test-feature-string" , " Not activated" )
1257+ val strValue = client.variableValue(" test-feature-string" , " Not activated" )
1258+
12101259 try {
12111260 client.onInitialized(object : DVCCallback <String > {
12121261 override fun onSuccess (result : String ) {
@@ -1228,15 +1277,19 @@ class DVCClientTests {
12281277 // Expect Client to have failed initialization, all variables should default
12291278 assert (! boolVar.value)
12301279 assert (boolVar.isDefaulted == true )
1280+ assert (! boolValue)
12311281
12321282 assert (numVar.value == 0 )
12331283 assert (numVar.isDefaulted == true )
1284+ assert (numValue == 0 )
12341285
12351286 assert (strVar.value == = " Not activated" )
12361287 assert (strVar.isDefaulted == true )
1288+ assert (strValue == = " Not activated" )
12371289
12381290 assert (jsonVar.value == = defaultJSON)
12391291 assert (jsonVar.isDefaulted == true )
1292+ assert (jsonValue == = defaultJSON)
12401293 }
12411294 }
12421295
0 commit comments