Search in sources :

Example 1 with CatchQualifierLiteral

use of org.apache.deltaspike.test.core.impl.exception.control.extension.literal.CatchQualifierLiteral in project deltaspike by apache.

the class HandlerComparatorTest method assertOrderIsCorrectWithQualifiers.

@Test
public void assertOrderIsCorrectWithQualifiers() {
    Set<Annotation> qualifiers = new HashSet<Annotation>();
    qualifiers.add(new CatchQualifierLiteral());
    List<HandlerMethod<? extends Throwable>> handlers = new ArrayList<HandlerMethod<? extends Throwable>>(storage.getHandlersForException(NullPointerException.class, bm, qualifiers, false));
    assertThat(handlers.size(), is(6));
    assertThat(((HandlerMethodImpl<?>) handlers.get(0)).getJavaMethod().getName(), is("catchThrowable"));
    assertThat(((HandlerMethodImpl<?>) handlers.get(1)).getJavaMethod().getName(), is("catchThrowableP20"));
    assertThat(((HandlerMethodImpl<?>) handlers.get(2)).getJavaMethod().getName(), is("qualifiedHandler"));
    assertThat(((HandlerMethodImpl<?>) handlers.get(3)).getJavaMethod().getName(), is("catchRuntime"));
    assertThat(((HandlerMethodImpl<?>) handlers.get(4)).getJavaMethod().getName(), is("npeHandlerNoDefQualifier"));
    assertThat(((HandlerMethodImpl<?>) handlers.get(5)).getJavaMethod().getName(), is("npeHandlerDefQualifier"));
}
Also used : CatchQualifierLiteral(org.apache.deltaspike.test.core.impl.exception.control.extension.literal.CatchQualifierLiteral) HandlerMethodImpl(org.apache.deltaspike.core.impl.exception.control.HandlerMethodImpl) ArrayList(java.util.ArrayList) Annotation(java.lang.annotation.Annotation) HandlerMethod(org.apache.deltaspike.core.api.exception.control.HandlerMethod) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 HandlerMethod (org.apache.deltaspike.core.api.exception.control.HandlerMethod)1 HandlerMethodImpl (org.apache.deltaspike.core.impl.exception.control.HandlerMethodImpl)1 CatchQualifierLiteral (org.apache.deltaspike.test.core.impl.exception.control.extension.literal.CatchQualifierLiteral)1 Test (org.junit.Test)1