public BaseInboundHandlerWithTracingAndMdcSupport() { Method[] methods = this.getClass().getMethods(); Map<String, Method> nameToMethodMap = Arrays.stream(methods) .filter(m -> m.getName().startsWith("do")) .collect(Collectors.toMap(Method::getName, m -> m)); isDefaultDoChannelRegisteredImpl = isDefaultMethodImpl("doChannelRegistered", nameToMethodMap); isDefaultDoChannelUnregisteredImpl = isDefaultMethodImpl("doChannelUnregistered", nameToMethodMap); isDefaultDoChannelActiveImpl = isDefaultMethodImpl("doChannelActive", nameToMethodMap); isDefaultDoChannelInactiveImpl = isDefaultMethodImpl("doChannelInactive", nameToMethodMap); isDefaultDoChannelReadImpl = isDefaultMethodImpl("doChannelRead", nameToMethodMap); isDefaultDoChannelReadCompleteImpl = isDefaultMethodImpl("doChannelReadComplete", nameToMethodMap); isDefaultDoUserEventTriggeredImpl = isDefaultMethodImpl("doUserEventTriggered", nameToMethodMap); isDefaultDoChannelWritabilityChangedImpl = isDefaultMethodImpl("doChannelWritabilityChanged", nameToMethodMap); isDefaultDoExceptionCaughtImpl = isDefaultMethodImpl("doExceptionCaught", nameToMethodMap); isDefaultDoHandlerAddedImpl = isDefaultMethodImpl("doHandlerAdded", nameToMethodMap); isDefaultDoHandlerRemovedImpl = isDefaultMethodImpl("doHandlerRemoved", nameToMethodMap); }
public BaseInboundHandlerWithTracingAndMdcSupport() { Method[] methods = this.getClass().getMethods(); Map<String, Method> nameToMethodMap = Arrays.stream(methods) .filter(m -> m.getName().startsWith("do")) .collect(Collectors.toMap(Method::getName, m -> m)); isDefaultDoChannelRegisteredImpl = isDefaultMethodImpl("doChannelRegistered", nameToMethodMap); isDefaultDoChannelUnregisteredImpl = isDefaultMethodImpl("doChannelUnregistered", nameToMethodMap); isDefaultDoChannelActiveImpl = isDefaultMethodImpl("doChannelActive", nameToMethodMap); isDefaultDoChannelInactiveImpl = isDefaultMethodImpl("doChannelInactive", nameToMethodMap); isDefaultDoChannelReadImpl = isDefaultMethodImpl("doChannelRead", nameToMethodMap); isDefaultDoChannelReadCompleteImpl = isDefaultMethodImpl("doChannelReadComplete", nameToMethodMap); isDefaultDoUserEventTriggeredImpl = isDefaultMethodImpl("doUserEventTriggered", nameToMethodMap); isDefaultDoChannelWritabilityChangedImpl = isDefaultMethodImpl("doChannelWritabilityChanged", nameToMethodMap); isDefaultDoExceptionCaughtImpl = isDefaultMethodImpl("doExceptionCaught", nameToMethodMap); isDefaultDoHandlerAddedImpl = isDefaultMethodImpl("doHandlerAdded", nameToMethodMap); isDefaultDoHandlerRemovedImpl = isDefaultMethodImpl("doHandlerRemoved", nameToMethodMap); }
@Test(expected = IllegalStateException.class) public void isDefaultMethodImpl_throws_IllegalStateException_if_method_cannot_be_found_in_map() { BaseInboundHandlerWithTracingAndMdcSupport.isDefaultMethodImpl(UUID.randomUUID().toString(), Collections.emptyMap()); }