<commit_before>// -----BEGIN DISCLAIMER-----
/*******************************************************************************
 * Copyright (c) 2010 JCrypTool Team and Contributors
 *
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
// -----END DISCLAIMER-----
package org.jcryptool.core.tests.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.jcryptool.core.CorePlugin;
import org.junit.Test;

/**
 * Tests for the JCrypTool Core plug-in and runtime.
 *
 * @author <NAME>
 * @version 0.9.4
 */
public class CorePluginTest {
    private static final String CORE_PLUGIN_ID = "org.jcryptool.core";

    @Test
    public void checkPluginID() {
        assertEquals(CORE_PLUGIN_ID, CorePlugin.getDefault().toString());
    }

    @Test
    public void testViews() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        IViewReference[] viewReferences = activePage.getViewReferences();

        assertEquals(5, viewReferences.length);

        assertEquals("org.jcryptool.fileexplorer.views.FileExplorerView", viewReferences[0].getId());
        assertEquals("File Explorer", viewReferences[0].getPartName());

        assertEquals("org.jcryptool.actions.views.ActionView", viewReferences[1].getId());
        assertEquals("Actions", viewReferences[1].getPartName());

        assertEquals("org.jcryptool.core.views.AlgorithmView", viewReferences[2].getId());
        assertEquals("Crypto Explorer", viewReferences[2].getPartName());

        assertEquals("org.eclipse.help.ui.HelpView", viewReferences[3].getId());
        assertEquals("Help", viewReferences[3].getPartName());

        assertEquals("org.eclipse.ui.internal.introview", viewReferences[4].getId());
        assertEquals("Welcome", viewReferences[4].getPartName());

        String[] shortcuts = activePage.getShowViewShortcuts();
        assertEquals(6, shortcuts.length);
        assertEquals("org.eclipse.ui.console.ConsoleView", shortcuts[0]);
        assertEquals("org.jcryptool.core.views.AlgorithmView", shortcuts[1]);
        assertEquals("org.jcryptool.fileexplorer.views.FileExplorerView", shortcuts[2]);
        assertEquals("org.eclipse.help.ui.HelpView", shortcuts[3]);
        assertEquals("org.jcryptool.actions.views.ActionView", shortcuts[4]);
        assertEquals("org.jcryptool.webbrowser.browser", shortcuts[5]);
    }

    @Test
    public void testPerspectives() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();

        IPerspectiveDescriptor perspective = activePage.getPerspective();
        assertEquals("org.jcryptool.core.perspective", perspective.getId());
        assertEquals("Default", perspective.getLabel());

        String[] shortcuts = activePage.getPerspectiveShortcuts();
        assertEquals(1, shortcuts.length);
        assertEquals("org.jcryptool.crypto.flexiprovider.ui.perspective.FlexiProviderPerspective", shortcuts[0]);
    }

    @Test
    public void testEditors() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
        IEditorRegistry registry = activeWorkbenchWindow.getWorkbench().getEditorRegistry();

        assertEquals("org.jcryptool.editor.text.editor.JCTTextEditor", registry.getDefaultEditor("test.txt").getId());
        assertEquals("net.sourceforge.ehep.editors.HexEditor", registry.getDefaultEditor("*.*").getId());
    }

    @Test
    public void testAddNewView() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();<commit_msg>Fixed unit test<commit_after>// -----BEGIN DISCLAIMER-----
/*******************************************************************************
 * Copyright (c) 2010 JCrypTool Team and Contributors
 *
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
// -----END DISCLAIMER-----
package org.jcryptool.core.tests.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.jcryptool.core.CorePlugin;
import org.junit.Test;

/**
 * Tests for the JCrypTool Core plug-in and runtime.
 *
 * @author <NAME>
 * @version 0.9.4
 */
public class CorePluginTest {
    private static final String CORE_PLUGIN_ID = "org.jcryptool.core";

    @Test
    public void checkPluginID() {
        assertEquals(CORE_PLUGIN_ID, CorePlugin.getDefault().toString());
    }

    @Test
    public void testViews() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        IViewReference[] viewReferences = activePage.getViewReferences();

        assertEquals(5, viewReferences.length);

        assertEquals("org.jcryptool.fileexplorer.views.FileExplorerView", viewReferences[0].getId());
        assertEquals("File Explorer", viewReferences[0].getPartName());

        assertEquals("org.jcryptool.actions.views.ActionView", viewReferences[1].getId());
        assertEquals("Actions", viewReferences[1].getPartName());

        assertEquals("org.jcryptool.core.views.AlgorithmView", viewReferences[2].getId());
        assertEquals("Crypto Explorer", viewReferences[2].getPartName());

        assertEquals("org.eclipse.help.ui.HelpView", viewReferences[3].getId());
        assertEquals("Help", viewReferences[3].getPartName());

        assertEquals("org.eclipse.ui.internal.introview", viewReferences[4].getId());
        assertEquals("Welcome", viewReferences[4].getPartName());

        String[] shortcuts = activePage.getShowViewShortcuts();
        assertEquals(6, shortcuts.length);
        assertEquals("org.eclipse.ui.console.ConsoleView", shortcuts[0]);
        assertEquals("org.jcryptool.core.views.AlgorithmView", shortcuts[1]);
        assertEquals("org.jcryptool.fileexplorer.views.FileExplorerView", shortcuts[2]);
        assertEquals("org.eclipse.help.ui.HelpView", shortcuts[3]);
        assertEquals("org.jcryptool.actions.views.ActionView", shortcuts[4]);
        assertEquals("org.jcryptool.webbrowser.browser", shortcuts[5]);
    }

    @Test
    public void testPerspectives() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();

        IPerspectiveDescriptor perspective = activePage.getPerspective();
        assertEquals("org.jcryptool.core.perspective", perspective.getId());
        assertEquals("Default", perspective.getLabel());

        String[] shortcuts = activePage.getPerspectiveShortcuts();
        assertEquals(1, shortcuts.length);
        assertEquals("org.jcryptool.crypto.flexiprovider.ui.perspective.FlexiProviderPerspective", shortcuts[0]);
    }

    @Test
    public void testEditors() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
        IEditorRegistry registry = activeWorkbenchWindow.getWorkbench().getEditorRegistry();

        assertEquals("org.jcryptool.editor.text.editor.JCTTextEditor", registry.getDefaultEditor("test.txt").getId());
        assertEquals("org.jcryptool.editors.hex.HexEditor", registry.getDefaultEditor("*.*").getId());
    }

    @Test
    public void testAddNewView() {
        IWorkbenchWindow activeWorkbenchWindow = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
{'fraction_non_alphanumeric': 0.1576612444545558, 'fraction_numerical': 0.007052667500853145, 'mean_word_length': 4.533039647577093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1796081', 'n_tokens_mistral': 2426, 'n_tokens_neox': 2286, 'n_words': 391}