IntegerPreference extends Preference<Integer> { @Nullable @Override public Integer get() { if (contains()) { return readSharedPreferences().getInt(getKey(), 0); } else { return getDefaultValue(); } } IntegerPreference(final String name, final String key,
            @Nullable final Integer defaultValue); @Override boolean exists(); @Nullable @Override Integer get();  }
@Test public void testGet() throws Exception { assertNull(mNullPref.get()); assertTrue(mTenPref.get() == 10); }