### Question:
BatchingMessageHandler implements Runnable, LifecycleMessageHandler<ReceivedInstantClusterIdAwareMessage<?>> { @Override public void handle( ReceivedInstantClusterIdAwareMessage<?> message ) { if ( stopped ) { log.debug( "This handler has been stopped, dropping the message: %s", message ); return; } BoundedPriorityQueue.Result result = inQueue.offer( message ); logQueueState( result ); } BatchingMessageHandler( LifecycleMessageHandler<ReceivedInstantClusterIdAwareMessage<?>> handler,
            BoundedPriorityQueue.Config inQueueConfig, Config batchConfig, Function<Runnable,ContinuousJob> jobFactory,
            LogProvider logProvider ); @Override void start( ClusterId clusterId ); @Override void stop(); @Override void handle( ReceivedInstantClusterIdAwareMessage<?> message ); @Override void run();  }### Answer:
@Test public void shouldInvokeHandlerOnQueuedMessage() throws Throwable { BatchingMessageHandler batchHandler = new BatchingMessageHandler( downstreamHandler, IN_QUEUE_CONFIG, BATCH_CONFIG, jobSchedulerFactory, NullLogProvider.getInstance() ); ReplicatedString content = new ReplicatedString( "dummy" ); NewEntry.Request message = new NewEntry.Request( null, content ); Future<?> future = executor.submit( batchHandler ); Thread.sleep( 50 ); batchHandler.handle( wrap( message ) ); future.get(); NewEntry.BatchRequest expected = new NewEntry.BatchRequest( singletonList( content ) ); verify( downstreamHandler ).handle( wrap( expected ) ); }