Back to project page Tacere.
The source code is released under:
MIT License
If you think the Android project Tacere listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (c) 2014 Jonathan Nelson// www . j a v a 2s .co m * Released under the BSD license. For details see the COPYING file. */ package org.ciasaboark.tacere.prefs; import junit.framework.TestCase; public class PrefsTest extends TestCase { /* @Test (expected = IllegalArgumentException.class) public void testStorePreferenceWithNullKey() { Prefs prefs = new Prefs(this.getContext()); prefs.storePreference(null, "foo"); } @Test (expected = IllegalArgumentException.class) public void testStorePreferenceWithNullValue() { Prefs prefs = new Prefs(this.getContext()); prefs.storePreference("foo", null); } @Test (expected = IllegalArgumentException.class) public void testStoreUnknownValueObject() { Prefs prefs = new Prefs(this.getContext()); prefs.storePreference("foo", new Object()); } public void testStoreIntegerValue() { Prefs prefs = new Prefs(this.getContext()); prefs.storePreference("foo", 1); assert(prefs.readInt("foo") == 1); } public void testStoreBooleanValue() { Prefs prefs = new Prefs(this.getContext()); prefs.storePreference("foo", false); assert(!prefs.getBoolean("foo")); } public void testStoreLongValue() { Prefs prefs = new Prefs(this.getContext()); prefs.storePreference("foo", 999l); assert(prefs.readLong("foo") == 999l); } public void testRestoreDefaultValues() { Prefs prefs = new Prefs(this.getContext()); prefs.restoreDefaultPreferences(); assert(prefs.getAdjustAlarm() == DefaultPrefs.ADJUST_ALARM); assert(prefs.getAdjustMedia() == DefaultPrefs.ADJUST_MEDIA); assert(prefs.isServiceActivated() == DefaultPrefs.IS_ACTIVATED); assert(prefs.shouldAllDayEventsSilence() == DefaultPrefs.SILENCE_ALL_DAY_EVENTS); assert(prefs.shouldAvailableEventsSilence() == DefaultPrefs.SILENCE_FREE_TIME); assert(prefs.getBufferMinutes() == DefaultPrefs.BUFFER_MINUTES); assert(prefs.getCurAlarmVolume() == DefaultPrefs.VOL); assert(prefs.getCurMediaVolume() == DefaultPrefs.VOLUME_MEDIA); assert(prefs.getLookaheadDays() == DefaultPrefs.LOOKAHEAD_DAYS); assert(prefs.getQuickSilenceHours() == DefaultPrefs.QUICK_SILENCE_HOURS); assert(prefs.getQuicksilenceMinutes() == DefaultPrefs.QUICK_SILENCE_MINUTES); assert(prefs.getInstanceRinger() == DefaultPrefs.RINGER_TYPE); } public void testRestoreDefaultPreferences() throws Exception { //TODO } */ }