/*
- * Copyright 2006 the original author or authors.
- *
+ * Copyright 2005-2010 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.wamblee.test;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Logger;
/**
* Tracks the occurence of certain events in a test environment. Threads in a
* test environment tell the event tracker of the occurrence of certain events
- * using {@link #eventOccurred(Event)}. Test code inspects the events sent by a
- * thread using {@link #isEventSent(Thread, Event)}.
+ * using {@link #eventOccurred(Object)}. Test code inspects the events sent by a
+ * thread using {@link #isEventSent(Thread, Object)}.
*
* A record is kept of every event which is sent. Therefore, the occurrence of a
* new event does not erase a previously sent event.
* @author Erik Brakkee
*/
public class EventTracker<Event> {
- private static final Log LOG = LogFactory.getLog(EventTracker.class);
+ private static final Logger LOG = Logger.getLogger(EventTracker.class
+ .getName());
/**
* Map of Thread object to a list of events.
clear();
}
- public void clear() {
+ public synchronized void clear() {
events = new HashMap<Thread, List<Event>>();
}