Search in sources :

Example 11 with ExceptionToCatchEvent

use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.

the class HandledExceptionHandlerTest method assertNoHandlersAfterHandledAreCalledDesc.

@Test
public void assertNoHandlersAfterHandledAreCalledDesc() {
    final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new Exception(new IllegalArgumentException()));
    bm.fireEvent(event);
    assertTrue(exceptionHandledHandler.isIaeAscCalled());
    assertFalse(exceptionHandledHandler.isExAscCalled());
    assertTrue(event.isHandled());
}
Also used : ExceptionToCatchEvent(org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent) Test(org.junit.Test)

Example 12 with ExceptionToCatchEvent

use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.

the class CallingHandlersTest method assertOutboundHanldersAreCalledOnce.

@Test
public void assertOutboundHanldersAreCalledOnce() {
    calledExceptionHandler.setOutboundHandlerTimesCalled(0);
    bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
    assertEquals(1, calledExceptionHandler.getOutboundHandlerTimesCalled());
}
Also used : ExceptionToCatchEvent(org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent) Test(org.junit.Test)

Example 13 with ExceptionToCatchEvent

use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.

the class CallingHandlersTest method assertInboundHanldersAreCalledOnce.

@Test
public void assertInboundHanldersAreCalledOnce() {
    calledExceptionHandler.setInboundHandlerTimesCalled(0);
    bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
    assertEquals(1, calledExceptionHandler.getInboundHandlerTimesCalled());
}
Also used : ExceptionToCatchEvent(org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent) Test(org.junit.Test)

Example 14 with ExceptionToCatchEvent

use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.

the class CallingHandlersTest method assertAdditionalParamsAreInjectedWithDifferentHandlerLocation.

//@Test //TODO discuss this test
public void assertAdditionalParamsAreInjectedWithDifferentHandlerLocation() {
    bm.fireEvent(new ExceptionToCatchEvent(new SQLException()));
    assertTrue(calledExceptionHandler.isLocationDifferBeanmanagerInjected());
}
Also used : SQLException(java.sql.SQLException) ExceptionToCatchEvent(org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent)

Example 15 with ExceptionToCatchEvent

use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.

the class CallingHandlersTest method assertOutboundHanldersAreCalled.

@Test
public void assertOutboundHanldersAreCalled() {
    bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
    assertTrue(calledExceptionHandler.isOutboundHandlerCalled());
}
Also used : ExceptionToCatchEvent(org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent) Test(org.junit.Test)

Aggregations

ExceptionToCatchEvent (org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent)17 Test (org.junit.Test)12 FacesContext (javax.faces.context.FacesContext)2 ExceptionQueuedEvent (javax.faces.event.ExceptionQueuedEvent)2 AccessDeniedException (org.apache.deltaspike.security.api.authorization.AccessDeniedException)2 ErrorViewAwareAccessDeniedException (org.apache.deltaspike.security.api.authorization.ErrorViewAwareAccessDeniedException)2 SQLException (java.sql.SQLException)1