StringPreference extends Preference<String> { @Nullable @Override public String get() { return readSharedPreferences().getString(getKey(), getDefaultValue()); } StringPreference(final String name, final String key,
            @Nullable final String defaultValue); @Override boolean exists(); @Nullable @Override String get();  }
@Test public void testGet() throws Exception { assertNull(mNullPref.get()); mNullPref.set((String) null); assertNull(mNullPref.get()); mNullPref.delete(); assertNull(mNullPref.get()); mNullPref.set("Android"); assertEquals(mNullPref.get(), "Android"); mNullPref.delete(); assertNull(mNullPref.get()); assertEquals(mEmptyPref.get(), ""); mEmptyPref.set("hi"); assertEquals(mEmptyPref.get(), "hi"); mEmptyPref.delete(); assertEquals(mEmptyPref.get(), ""); assertEquals(mHelloPref.get(), "Hello, World!"); mHelloPref.set((String) null); assertEquals(mHelloPref.get(), "Hello, World!"); mHelloPref.delete(); assertEquals(mHelloPref.get(), "Hello, World!"); }