Android Open Source - SeniorDesign Settings Test






From Project

Back to project page SeniorDesign.

License

The source code is released under:

GNU General Public License

If you think the Android project SeniorDesign listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package fakesetgame.seniordesign;
//  w  w  w  .  j av  a  2 s.c o m
import android.app.Application;
import android.test.ApplicationTestCase;

import junit.framework.Assert;

import fakesetgame.seniordesign.data.OptionsHelper;
import fakesetgame.seniordesign.data.PlayerDataDbHelper;
import fakesetgame.seniordesign.data.Setting;

/**
 * Created by Chris on 10/27/2014.
 */
public class SettingsTest extends ApplicationTestCase<Application> {

    public SettingsTest() {
        super(Application.class);
    }

    public void testGetAndSaveSetting(){
        String testSettingName = "TEST SETTING 1283683214";
        String testSettingValue1 = "This is the test setting value";
        String testSettingValue2 = "This is another test setting value";

        Setting setting = PlayerDataDbHelper.getSetting(getContext(), testSettingName);
        Assert.assertNull(setting);

        // Test insert
        PlayerDataDbHelper.saveSetting(getContext(), testSettingName, testSettingValue1);
        setting = PlayerDataDbHelper.getSetting(getContext(), testSettingName);
        Assert.assertEquals(testSettingName, setting.getName());
        Assert.assertEquals(testSettingValue1, setting.getValue());

        // Test update
        PlayerDataDbHelper.saveSetting(getContext(), testSettingName, testSettingValue2);
        setting = PlayerDataDbHelper.getSetting(getContext(), testSettingName);
        Assert.assertEquals(testSettingName, setting.getName());
        Assert.assertEquals(testSettingValue2, setting.getValue());

        // Test delete
        PlayerDataDbHelper.deleteSetting(getContext(), testSettingName);
        setting = PlayerDataDbHelper.getSetting(getContext(), testSettingName);
        Assert.assertNull(setting);
    }

    public void testOptionsHelper() {
        // TODO: Rewrite this test
    }
}




Java Source Code List

fakesetgame.seniordesign.BoardTest.java
fakesetgame.seniordesign.GameScreen.java
fakesetgame.seniordesign.GameTest.java
fakesetgame.seniordesign.HomeScreen.java
fakesetgame.seniordesign.OptionsScreen.java
fakesetgame.seniordesign.SettingsTest.java
fakesetgame.seniordesign.SplashScreen.java
fakesetgame.seniordesign.SummaryScreen.java
fakesetgame.seniordesign.TileSetTest.java
fakesetgame.seniordesign.data.FoundSetRecord.java
fakesetgame.seniordesign.data.GameOutcome.java
fakesetgame.seniordesign.data.GameSummaryListItemCursorAdapter.java
fakesetgame.seniordesign.data.OptionsHelper.java
fakesetgame.seniordesign.data.PlayerDataDbHelper.java
fakesetgame.seniordesign.data.Setting.java
fakesetgame.seniordesign.data.package-info.java
fakesetgame.seniordesign.model.BoardSize.java
fakesetgame.seniordesign.model.Board.java
fakesetgame.seniordesign.model.Color.java
fakesetgame.seniordesign.model.GameOverEvent.java
fakesetgame.seniordesign.model.GameOverListener.java
fakesetgame.seniordesign.model.Game.java
fakesetgame.seniordesign.model.HintProvider.java
fakesetgame.seniordesign.model.Modifier.java
fakesetgame.seniordesign.model.Shading.java
fakesetgame.seniordesign.model.Shape.java
fakesetgame.seniordesign.model.TileSet.java
fakesetgame.seniordesign.model.Tile.java
fakesetgame.seniordesign.model.package-info.java
fakesetgame.seniordesign.view.GameSummaryListItemView.java
fakesetgame.seniordesign.view.ShadedImageView.java
fakesetgame.seniordesign.view.package-info.java
fakesetgame.seniordesign.package-info.java