<commit_before>package com.dumptruckman.minecraft.pluginbase.logging;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.MockGateway;
import org.powermock.modules.junit4.PowerMockRunner;

import java.io.File;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(PowerMockRunner.class)
public class LoggingTest {

    static final String NAME = "Logging-Test";
    static final String SIMPLE_MESSAGE = "This is a test.";
    static final String ARGS_MESSAGE = "This is a %s test with some %s%s";

    LoggablePlugin plugin;
    final TestHandler handler = new TestHandler(false);
    final TestHandler parentHandler = new TestHandler(true);

    PluginLogger logging;

    @Before
    public void setUp() throws Exception {
        MockGateway.MOCK_STANDARD_METHODS = false;
        plugin = mock(LoggablePlugin.class);
        when(plugin.getName()).thenReturn("Logging-Test");
        FileUtils.deleteFolder(new File("bin"));
        final File testFolder = new File("bin/test/server/plugins/Logging-Test");
        testFolder.mkdirs();
        when(plugin.getDataFolder()).thenReturn(testFolder);
        logging = PluginLogger.getLogger(plugin);
        Logging.init(plugin);
    }

    @After
    public void tearDown() throws Exception {
        logging.shutdown();
        PluginLogger.initializedLoggers.clear();
    }

    @Test
    public void testInit() throws Exception {
        assertEquals(logging.name, plugin.getName());
        assertEquals(logging.debugLog.debugLevel, DebugLog.ORIGINAL_DEBUG_LEVEL);
        assertEquals(logging.plugin, plugin);
        assertNotNull(logging.debugLog);
    }

    @Test
    public void testShutdown() throws Exception {
        logging.shutdown();
        assertEquals(logging.debugLog.debugLevel, DebugLog.ORIGINAL_DEBUG_LEVEL);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testSetDebugLevelTooHigh() throws Exception {
        logging.setDebugLevel(4);
    }
<commit_msg>Minor fixes for tests.<commit_after>package com.dumptruckman.minecraft.pluginbase.logging;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.MockGateway;
import org.powermock.modules.junit4.PowerMockRunner;

import java.io.File;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;

import static junit.framework.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(PowerMockRunner.class)
public class LoggingTest {

    static final String NAME = "Logging-Test";
    static final String SIMPLE_MESSAGE = "This is a test.";
    static final String ARGS_MESSAGE = "This is a %s test with some %s%s";

    LoggablePlugin plugin;
    final TestHandler handler = new TestHandler(false);
    final TestHandler parentHandler = new TestHandler(true);

    PluginLogger logging;

    @Before
    public void setUp() throws Exception {
        MockGateway.MOCK_STANDARD_METHODS = false;
        plugin = mock(LoggablePlugin.class);
        when(plugin.getName()).thenReturn("Logging-Test");
        FileUtils.deleteFolder(new File("bin"));
        final File testFolder = new File("bin/test/server/plugins/Logging-Test");
        testFolder.mkdirs();
        when(plugin.getDataFolder()).thenReturn(testFolder);
        logging = PluginLogger.getLogger(plugin);
        Logging.init(plugin);
    }

    @After
    public void tearDown() throws Exception {
        logging.shutdown();
        PluginLogger.INITIALIZED_LOGGERS.clear();
    }

    @Test
    public void testInit() throws Exception {
        assertNotNull(logging.debugLog);
        assertEquals(logging.pluginName, plugin.getName());
        assertEquals(logging.debugLog.debugLevel, DebugLog.ORIGINAL_DEBUG_LEVEL);
        assertEquals(logging.plugin, plugin);
    }

    @Test
    public void testShutdown() throws Exception {
        logging.shutdown();
        assertEquals(logging.debugLog.debugLevel, DebugLog.ORIGINAL_DEBUG_LEVEL);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testSetDebugLevelTooHigh() throws Exception {
        logging.setDebugLevel(4);
    }

{'fraction_non_alphanumeric': 0.10135135135135136, 'fraction_numerical': 0.0008445945945945946, 'mean_word_length': 3.789686552072801, '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': '537699', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1334, 'n_words': 290}