From 3e8693793cb8305584a1983120615519f699cd41 Mon Sep 17 00:00:00 2001 From: Dabo Ross Date: Thu, 5 Sep 2013 22:08:30 -0700 Subject: [PATCH] Add multiple listeners to EventPriorityTest --- .../md_5/bungee/event/EventPriorityTest.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/event/src/test/java/net/md_5/bungee/event/EventPriorityTest.java b/event/src/test/java/net/md_5/bungee/event/EventPriorityTest.java index 8dc3f5d9..62356886 100644 --- a/event/src/test/java/net/md_5/bungee/event/EventPriorityTest.java +++ b/event/src/test/java/net/md_5/bungee/event/EventPriorityTest.java @@ -14,6 +14,7 @@ public class EventPriorityTest public void testPriority() { bus.register( this ); + bus.register( new EventPriorityListenerPartner() ); bus.post( new PriorityTestEvent() ); Assert.assertEquals( 0, latch.getCount() ); } @@ -21,28 +22,14 @@ public class EventPriorityTest @EventHandler(priority = EventPriority.LOWEST) public void onLowestPriority(PriorityTestEvent event) { - Assert.assertEquals( latch.getCount(), 5 ); - latch.countDown(); - } - - @EventHandler(priority = EventPriority.LOW) - public void onLowPriority(PriorityTestEvent event) - { - Assert.assertEquals( latch.getCount(), 4 ); + Assert.assertEquals( 5, latch.getCount() ); latch.countDown(); } @EventHandler public void onNormalPriority(PriorityTestEvent event) { - Assert.assertEquals( latch.getCount(), 3 ); - latch.countDown(); - } - - @EventHandler(priority = EventPriority.HIGH) - public void onHighPriority(PriorityTestEvent event) - { - Assert.assertEquals( 2, latch.getCount() ); + Assert.assertEquals( 3, latch.getCount() ); latch.countDown(); } @@ -56,4 +43,22 @@ public class EventPriorityTest public static class PriorityTestEvent { } + + public class EventPriorityListenerPartner + { + + @EventHandler(priority = EventPriority.HIGH) + public void onHighPriority(PriorityTestEvent event) + { + Assert.assertEquals( 2, latch.getCount() ); + latch.countDown(); + } + + @EventHandler(priority = EventPriority.LOW) + public void onLowPriority(PriorityTestEvent event) + { + Assert.assertEquals( 4, latch.getCount() ); + latch.countDown(); + } + } }