<commit_before>package com.zachsthings.onevent;

import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

/**
 *
 * @author zml2008
 */
public class SimpleEventManagerTest {
	protected EventManager eventManager;
    protected static final Logger logger = Logger.getLogger(SimpleEventManagerTest.class.getCanonicalName());

	@Before
	public void setUp() {
		eventManager = new SimpleEventManager(logger);
	}

	@Test
	public void testEventCalling() {
		final EventManager eventManager = new SimpleEventManager(logger);
		final TestListener testListener = new TestListener();
		eventManager.registerEvents(testListener, this);
		eventManager.callEvent(new TestEvent());
		assertTrue(testListener.hasBeenCalled());
	}
	
	@Test
	public void testEventPriorities() {
		final EventManager eventManager = new SimpleEventManager(logger);
		final List<Order> calledOrders = new ArrayList<Order>();
		for (final Order order : Order.values()) {
			eventManager.registerEvent(TestEvent.class, order, new EventExecutor() {
				public void execute(Event event) throws EventException {
					calledOrders.add(order);
				}
			}, this);
		}
		eventManager.callEvent(new TestEvent());
		assertEquals(calledOrders.size(), Order.values().length);
		for (Order order : Order.values()) {
			assertTrue("Order not contained in results list! ", calledOrders.indexOf(order) >= 0);
			assertEquals(calledOrders.get(order.getIndex()), order);
		}
	}
}
<commit_msg>Don't create a new SimpleEventManager each test<commit_after>package com.zachsthings.onevent;

import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

/**
 *
 * @author zml2008
 */
public class SimpleEventManagerTest {
	protected EventManager eventManager;
    protected static final Logger logger = Logger.getLogger(SimpleEventManagerTest.class.getCanonicalName());

	@Before
	public void setUp() {
		eventManager = new SimpleEventManager(logger);
	}

	@Test
	public void testEventCalling() {
		final TestListener testListener = new TestListener();
		eventManager.registerEvents(testListener, this);
		eventManager.callEvent(new TestEvent());
		assertTrue(testListener.hasBeenCalled());
	}
	
	@Test
	public void testEventPriorities() {
		final List<Order> calledOrders = new ArrayList<Order>();
		for (final Order order : Order.values()) {
			eventManager.registerEvent(TestEvent.class, order, new EventExecutor() {
				public void execute(Event event) throws EventException {
					calledOrders.add(order);
				}
			}, this);
		}
		eventManager.callEvent(new TestEvent());
		assertEquals(calledOrders.size(), Order.values().length);
		for (Order order : Order.values()) {
			assertTrue("Order not contained in results list! ", calledOrders.indexOf(order) >= 0);
			assertEquals(calledOrders.get(order.getIndex()), order);
		}
	}
}

{'fraction_non_alphanumeric': 0.11672240802675585, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 5.167010309278351, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4740348', 'n_tokens_mistral': 933, 'n_tokens_neox': 857, 'n_words': 204}