@Test void testStartRegistersCreatedMessageHandler(@Mock Configuration config) { AtomicBoolean isCreated = new AtomicBoolean(false); AtomicBoolean isRegistered = new AtomicBoolean(false); MessageHandlerRegistrar testSubject = new MessageHandlerRegistrar( () -> config, c -> new SomeMessageHandler(isCreated), (c, msgHandler) -> { isRegistered.set(true); return TEST_REGISTRATION_IMPLEMENTATION; } ); testSubject.start(); assertTrue(isCreated.get()); assertTrue(isRegistered.get()); }
@StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) public void start() { Configuration config = configurationSupplier.get(); Object annotatedHandler = messageHandlerBuilder.apply(config); assertNonNull(annotatedHandler, "AnnotatedMessageHandler may not be null"); this.handlerRegistration = messageHandlerSubscriber.apply(config, annotatedHandler); }
MessageHandlerRegistrar { @StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) public void start() { Configuration config = configurationSupplier.get(); Object annotatedHandler = messageHandlerBuilder.apply(config); assertNonNull(annotatedHandler, "AnnotatedMessageHandler may not be null"); this.handlerRegistration = messageHandlerSubscriber.apply(config, annotatedHandler); } }
MessageHandlerRegistrar { @StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) public void start() { Configuration config = configurationSupplier.get(); Object annotatedHandler = messageHandlerBuilder.apply(config); assertNonNull(annotatedHandler, "AnnotatedMessageHandler may not be null"); this.handlerRegistration = messageHandlerSubscriber.apply(config, annotatedHandler); } MessageHandlerRegistrar(Supplier<Configuration> configSupplier,
                                   Function<Configuration, Object> messageHandlerBuilder,
                                   BiFunction<Configuration, Object, Registration> messageHandlerSubscriber); }
MessageHandlerRegistrar { @StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) public void start() { Configuration config = configurationSupplier.get(); Object annotatedHandler = messageHandlerBuilder.apply(config); assertNonNull(annotatedHandler, "AnnotatedMessageHandler may not be null"); this.handlerRegistration = messageHandlerSubscriber.apply(config, annotatedHandler); } MessageHandlerRegistrar(Supplier<Configuration> configSupplier,
                                   Function<Configuration, Object> messageHandlerBuilder,
                                   BiFunction<Configuration, Object, Registration> messageHandlerSubscriber); @StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) void start(); @ShutdownHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) void shutdown(); }
MessageHandlerRegistrar { @StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) public void start() { Configuration config = configurationSupplier.get(); Object annotatedHandler = messageHandlerBuilder.apply(config); assertNonNull(annotatedHandler, "AnnotatedMessageHandler may not be null"); this.handlerRegistration = messageHandlerSubscriber.apply(config, annotatedHandler); } MessageHandlerRegistrar(Supplier<Configuration> configSupplier,
                                   Function<Configuration, Object> messageHandlerBuilder,
                                   BiFunction<Configuration, Object, Registration> messageHandlerSubscriber); @StartHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) void start(); @ShutdownHandler(phase = Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS) void shutdown();  }