summaryrefslogtreecommitdiff
path: root/core/tests/systemproperties
diff options
context:
space:
mode:
authorDaniel Colascione <dancol@google.com>2019-11-22 14:23:11 -0800
committerGreg Kaiser <gkaiser@google.com>2019-11-25 06:33:29 -0800
commited4023a61d91adbaf6db7705b9c280c6dc865fa9 (patch)
tree72138b75962e8c035728ad096ec332a0673ca677 /core/tests/systemproperties
parented2a3ec9b48a1e34445a95cbd3b820484a1d0477 (diff)
Add tests for property reads from unset properties
Test: atest FrameworksCoreSystemPropertiesTests Bug: 144958550 Change-Id: I33c02013f6fb42c3cd974f76cd593940d4f1705b
Diffstat (limited to 'core/tests/systemproperties')
-rw-r--r--core/tests/systemproperties/src/android/os/SystemPropertiesTest.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/tests/systemproperties/src/android/os/SystemPropertiesTest.java b/core/tests/systemproperties/src/android/os/SystemPropertiesTest.java
index b48ac3347093..9f70538191c2 100644
--- a/core/tests/systemproperties/src/android/os/SystemPropertiesTest.java
+++ b/core/tests/systemproperties/src/android/os/SystemPropertiesTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
public class SystemPropertiesTest extends TestCase {
private static final String KEY = "sys.testkey";
+ private static final String UNSET_KEY = "Aiw7woh6ie4toh7W";
private static final String PERSIST_KEY = "persist.sys.testkey";
@SmallTest
@@ -133,6 +134,15 @@ public class SystemPropertiesTest extends TestCase {
}
@SmallTest
+ public void testUnset() throws Exception {
+ assertEquals("abc", SystemProperties.get(UNSET_KEY, "abc"));
+ assertEquals(true, SystemProperties.getBoolean(UNSET_KEY, true));
+ assertEquals(false, SystemProperties.getBoolean(UNSET_KEY, false));
+ assertEquals(5, SystemProperties.getInt(UNSET_KEY, 5));
+ assertEquals(-10, SystemProperties.getLong(UNSET_KEY, -10));
+ }
+
+ @SmallTest
@SuppressWarnings("null")
public void testNullKey() throws Exception {
try {