<commit_before>package gr.jchrist.gitextender.configuration;

import gr.jchrist.gitextender.TestingUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author jchrist
 * @since 2017/01/15
 */
public class SettingsViewTest {
    private TestingUtil.BaseTest base;
    private SettingsView settingsView;

    @Before
    public void before() throws Exception {
        base = TestingUtil.getBaseTest();
        base.setUp();
        settingsView = new SettingsView();
    }

    @After
    public void after() throws Exception {
        base.tearDown();
    }

    @Test
    public void testSetup() throws Exception {
        settingsView.setup();
        assertThat(settingsView.getMainPanel()).isNotNull();
        assertThat(settingsView.getAttemptMergeAbort()).isNotNull();
    }

    @Test
    public void testGetId() throws Exception {
        assertThat(settingsView.getId()).isEqualTo(SettingsView.DIALOG_TITLE);
    }

    @Test
    public void testGetDisplayName() throws Exception {
        assertThat(settingsView.getDisplayName()).isEqualTo(SettingsView.DIALOG_TITLE);
    }

    @Test
    public void testGetHelpTopic() throws Exception {
        assertThat(settingsView.getHelpTopic()).isNull();
    }

    @Test
    public void testCreateComponent() throws Exception {
        assertThat(settingsView.createComponent()).isNotNull();
    }

    @Test
    public void testIsModifiedApply() throws Exception {
        assertThat(settingsView.isModified()).isTrue();
        settingsView.apply();
        assertThat(settingsView.isModified()).isFalse();
    }

    @Test
    public void testDisposeUIResources() throws Exception {
        settingsView.disposeUIResources();
        assertThat(settingsView.getMainPanel()).isNull();
        assertThat(settingsView.getAttemptMergeAbort()).isNull();
    }

    @Test
    public void testFill() throws Exception {
        assertThat(settingsView.getAttemptMergeAbort().isSelected()).isFalse();
        GitExtenderSettings ges = new GitExtenderSettings();
        ges.attemptMergeAbort = true;
        settingsView.fill(ges);
        assertThat(settingsView.getAttemptMergeAbort().isSelected()).isTrue();
    }

    @Test
    public void testSave() throws Exception {
        assertThat(settingsView.save().getAttemptMergeAbort()).isFalse();
        GitExtenderSettings ges = new GitExtenderSettings();
        ges.attemptMergeAbort = true;
        settingsView.fill(ges);
        assertThat(settingsView.save().getAttemptMergeAbort()).isTrue();
    }
}<commit_msg>fixed tests by overriding service for GitExtenderSettings<commit_after>package gr.jchrist.gitextender.configuration;

import gr.jchrist.gitextender.GitTestUtil;
import gr.jchrist.gitextender.TestingUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author jchrist
 * @since 2017/01/15
 */
public class SettingsViewTest {
    private TestingUtil.BaseTest base;
    private SettingsView settingsView;

    @Before
    public void before() throws Exception {
        base = TestingUtil.getBaseTest();
        base.setUp();
        GitTestUtil.overrideService(GitExtenderSettings.class, GitExtenderSettings.class);
        GitExtenderSettings settings = GitExtenderSettings.getInstance();
        assertThat(settings).isNotNull();
        settingsView = new SettingsView();
    }

    @After
    public void after() throws Exception {
        base.tearDown();
    }

    @Test
    public void testSetup() throws Exception {
        settingsView.setup();
        assertThat(settingsView.getMainPanel()).isNotNull();
        assertThat(settingsView.getAttemptMergeAbort()).isNotNull();
    }

    @Test
    public void testGetId() throws Exception {
        assertThat(settingsView.getId()).isEqualTo(SettingsView.DIALOG_TITLE);
    }

    @Test
    public void testGetDisplayName() throws Exception {
        assertThat(settingsView.getDisplayName()).isEqualTo(SettingsView.DIALOG_TITLE);
    }

    @Test
    public void testGetHelpTopic() throws Exception {
        assertThat(settingsView.getHelpTopic()).isNull();
    }

    @Test
    public void testCreateComponent() throws Exception {
        assertThat(settingsView.createComponent()).isNotNull();
    }

    @Test
    public void testIsModifiedApply() throws Exception {
        assertThat(settingsView.isModified()).isFalse();
        settingsView.getAttemptMergeAbort().setSelected(true);
        assertThat(settingsView.isModified()).isTrue();
        settingsView.apply();
        assertThat(settingsView.isModified()).isFalse();
        assertThat(settingsView.getAttemptMergeAbort().isSelected()).isTrue();
    }

    @Test
    public void testDisposeUIResources() throws Exception {
        settingsView.disposeUIResources();
        assertThat(settingsView.getMainPanel()).isNull();
        assertThat(settingsView.getAttemptMergeAbort()).isNull();
    }

    @Test
    public void testFill() throws Exception {
        assertThat(settingsView.getAttemptMergeAbort().isSelected()).isFalse();
        GitExtenderSettings ges = new GitExtenderSettings();
        ges.attemptMergeAbort = true;
        settingsView.fill(ges);
        assertThat(settingsView.getAttemptMergeAbort().isSelected()).isTrue();
    }

    @Test
    public void testSave() throws Exception {
        assertThat(settingsView.save().getAttemptMergeAbort()).isFalse();
        GitExtenderSettings ges = new GitExtenderSettings();
        ges.attemptMergeAbort = true;
        settingsView.fill(ges);
        assertThat(settingsView.save().getAttemptMergeAbort()).isTrue();
    }
}
{'fraction_non_alphanumeric': 0.10942142981996154, 'fraction_numerical': 0.0027967138612130745, 'mean_word_length': 3.4494556765163296, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6891075', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1522, 'n_words': 277}