making preference reading code more robust

This commit is contained in:
alunny
2012-01-02 22:40:08 -08:00
parent 3af4d6b139
commit ffa76246e3
3 changed files with 27 additions and 2 deletions

View File

@@ -38,4 +38,18 @@ public class PreferenceSetTest {
// return null if the preference is not defined
assertEquals(null, preferences.pref("antigravity"));
}
@Test
public void testUnsetPreferenceChecking() {
PreferenceSet emptySet = new PreferenceSet();
boolean value = emptySet.prefMatches("fullscreen", "true");
assertEquals(false, value);
}
@Test
public void testSetPreferenceChecking() {
preferences.add(screen);
boolean value = preferences.prefMatches("fullscreen", "true");
assertEquals(true, value);
}
}