Add multiple listeners to EventPriorityTest
This commit is contained in:
parent
bb47aba682
commit
3e8693793c
@ -14,6 +14,7 @@ public class EventPriorityTest
|
|||||||
public void testPriority()
|
public void testPriority()
|
||||||
{
|
{
|
||||||
bus.register( this );
|
bus.register( this );
|
||||||
|
bus.register( new EventPriorityListenerPartner() );
|
||||||
bus.post( new PriorityTestEvent() );
|
bus.post( new PriorityTestEvent() );
|
||||||
Assert.assertEquals( 0, latch.getCount() );
|
Assert.assertEquals( 0, latch.getCount() );
|
||||||
}
|
}
|
||||||
@ -21,28 +22,14 @@ public class EventPriorityTest
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onLowestPriority(PriorityTestEvent event)
|
public void onLowestPriority(PriorityTestEvent event)
|
||||||
{
|
{
|
||||||
Assert.assertEquals( latch.getCount(), 5 );
|
Assert.assertEquals( 5, latch.getCount() );
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
|
||||||
public void onLowPriority(PriorityTestEvent event)
|
|
||||||
{
|
|
||||||
Assert.assertEquals( latch.getCount(), 4 );
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNormalPriority(PriorityTestEvent event)
|
public void onNormalPriority(PriorityTestEvent event)
|
||||||
{
|
{
|
||||||
Assert.assertEquals( latch.getCount(), 3 );
|
Assert.assertEquals( 3, latch.getCount() );
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
|
||||||
public void onHighPriority(PriorityTestEvent event)
|
|
||||||
{
|
|
||||||
Assert.assertEquals( 2, latch.getCount() );
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,4 +43,22 @@ public class EventPriorityTest
|
|||||||
public static class PriorityTestEvent
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user