*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* 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
/**
* 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.
*
* A record is kept of every event which is sent. Therefore, the occurrence of a
* new event does not erase a previously sent event.
* Type of event sent from test code. Usually String will be
* sufficient. The event type must provide a sensible implementation
* of {@link java.lang.Object#equals(java.lang.Object)}.
* Type of event sent from test code. Usually String will be
* sufficient. The event type must provide a sensible implementation
* of {@link java.lang.Object#equals(java.lang.Object)}.
if (eventList == null) {
eventList = new ArrayList<Event>();
events.put(current, eventList);
}
if (eventList == null) {
eventList = new ArrayList<Event>();
events.put(current, eventList);
}
*/
public synchronized boolean isEventSent(Thread aThread, Event aEvent) {
List<Event> eventList = events.get(aThread);
*/
public synchronized boolean isEventSent(Thread aThread, Event aEvent) {
List<Event> eventList = events.get(aThread);
*/
public synchronized List<Event> getEvents(Thread aThread) {
List<Event> eventList = events.get(aThread);
*/
public synchronized List<Event> getEvents(Thread aThread) {
List<Event> eventList = events.get(aThread);
- public synchronized int getEventCount() {
- int count = 0;
- for (Thread thread: events.keySet()) {
- count += events.get(thread).size();
- }
- return count;
+ public synchronized int getEventCount() {
+ int count = 0;
+
+ for (Thread thread : events.keySet()) {
+ count += events.get(thread).size();
+ }
+
+ return count;