mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
improve exception handling of ThrowingEventBus
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.event;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -49,6 +50,10 @@ import sonia.scm.user.UserEvent;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -133,7 +138,30 @@ public class GuavaScmEventBusTest extends AbstractTestBase
|
||||
*
|
||||
*/
|
||||
@Test(expected = EventBusException.class)
|
||||
public void testSyncPostWithException()
|
||||
public void testSyncPostWithCheckedException()
|
||||
{
|
||||
GuavaScmEventBus eventBus = new GuavaScmEventBus();
|
||||
|
||||
eventBus.register(new Object()
|
||||
{
|
||||
|
||||
@Subscribe
|
||||
public void handleEvent(Object event) throws IOException
|
||||
{
|
||||
throw new IOException("could not handle event");
|
||||
}
|
||||
|
||||
}, false);
|
||||
|
||||
eventBus.post(new Object());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Test(expected = RuntimeException.class)
|
||||
public void testSyncPostWithRuntimeException()
|
||||
{
|
||||
GuavaScmEventBus eventBus = new GuavaScmEventBus();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user