Package com.github.eclipsecolortheme.test

Source Code of com.github.eclipsecolortheme.test.ColorThemeMappingTest

package com.github.eclipsecolortheme.test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;

import org.junit.Before;
import org.junit.Test;

import com.github.eclipsecolortheme.ColorThemeMapping;
import com.github.eclipsecolortheme.ColorThemeSetting;
import com.github.eclipsecolortheme.test.mock.MockEclipsePreferences;

public class ColorThemeMappingTest {
    private ColorThemeMapping mapping;

    @Before
    public void setUp() {
        mapping = new ColorThemeMapping("org.eclipse.php.ui.color", "foreground");
    }

    @Test
    public void putPreferences() {
        MockEclipsePreferences preferences = new MockEclipsePreferences();
        ColorThemeSetting setting = new ColorThemeSetting("#336699");
        mapping.putPreferences(preferences, setting);
        assertThat(preferences.get("org.eclipse.php.ui.color", null), is("51,102,153"));
    }

    @Test
    public void removePreferences() {
        MockEclipsePreferences preferences = new MockEclipsePreferences();
        mapping.putPreferences(preferences, new ColorThemeSetting("#336699"));
        mapping.removePreferences(preferences);
        assertThat(preferences.get("org.eclipse.php.ui.color", null), nullValue());
    }

    @Test
    public void getThemeKey() {
        assertThat((String) mapping.getThemeKey(), is("foreground"));
    }
}
TOP

Related Classes of com.github.eclipsecolortheme.test.ColorThemeMappingTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.