2021-02-09 09:52:26 +01:00
|
|
|
package dev.kske.eventbus.core;
|
2020-09-03 09:52:00 +02:00
|
|
|
|
|
|
|
/**
|
2022-01-09 14:16:30 +01:00
|
|
|
* A simple event for testing purposes. The event contains a counter that is supposed to be
|
|
|
|
* incremented when the event is processed by a handler. That way it is possible to test whether all
|
|
|
|
* handlers that were supposed to be invoked were in fact invoked.
|
2020-09-03 09:52:00 +02:00
|
|
|
*
|
|
|
|
* @author Kai S. K. Engelbart
|
|
|
|
* @since 0.0.1
|
|
|
|
*/
|
2022-01-09 14:16:30 +01:00
|
|
|
class SimpleEvent {
|
|
|
|
|
|
|
|
private int counter;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2022-01-18 13:44:33 +01:00
|
|
|
return String.format("%s[%d]", getClass().getSimpleName(), counter);
|
2022-01-09 14:16:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void increment() {
|
|
|
|
++counter;
|
|
|
|
}
|
|
|
|
|
|
|
|
int getCounter() {
|
|
|
|
return counter;
|
|
|
|
}
|
|
|
|
|
|
|
|
void reset() {
|
|
|
|
counter = 0;
|
|
|
|
}
|
|
|
|
}
|