Simplify cancellation test, fix a typo
This commit is contained in:
parent
8aefb43823
commit
659bd7888f
@ -12,8 +12,7 @@ import org.junit.jupiter.api.*;
|
|||||||
*/
|
*/
|
||||||
class EventBusTest implements EventListener {
|
class EventBusTest implements EventListener {
|
||||||
|
|
||||||
int hits;
|
int hits, cancelledHits;
|
||||||
static int canceledHits;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void registerListener() {
|
public void registerListener() {
|
||||||
@ -28,10 +27,8 @@ class EventBusTest implements EventListener {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCancellation() {
|
void testCancellation() {
|
||||||
var test2 = new EventBusTest();
|
|
||||||
test2.registerListener();
|
|
||||||
EventBus.getInstance().dispatch(new SimpleCancelEvent());
|
EventBus.getInstance().dispatch(new SimpleCancelEvent());
|
||||||
assertTrue(canceledHits == 1);
|
assertTrue(cancelledHits == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Event(eventType = SimpleEvent.class, includeSubtypes = true, priority = 200)
|
@Event(eventType = SimpleEvent.class, includeSubtypes = true, priority = 200)
|
||||||
@ -54,8 +51,8 @@ class EventBusTest implements EventListener {
|
|||||||
|
|
||||||
@Event(eventType = SimpleCancelEvent.class, priority = 500)
|
@Event(eventType = SimpleCancelEvent.class, priority = 500)
|
||||||
private void onSimpleCancelFirst() {
|
private void onSimpleCancelFirst() {
|
||||||
++canceledHits;
|
++cancelledHits;
|
||||||
assertTrue(canceledHits == 1);
|
assertTrue(cancelledHits == 1);
|
||||||
EventBus.getInstance().cancel();
|
EventBus.getInstance().cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user