Buggy code:
public class MessageBrokerConfigurationTests { private AnnotationConfigApplicationContext simpleBrokerContext ; private AnnotationConfigApplicationContext brokerRelayContext ; private AnnotationConfigApplicationContext defaultContext ; private AnnotationConfigApplicationContext customContext ; @ Before public void setupOnce ( ) { } @ Test public void clientInboundChannel ( ) { } @ Test public void clientInboundChannelWithBrokerRelay ( ) { } @ Test public void clientInboundChannelCustomized ( ) { AbstractSubscribableChannel channel = this . customContext . getBean ( "clientInboundChannel" , AbstractSubscribableChannel . class ) ; <START_BUG> assertEquals ( 1 , channel . getInterceptors ( ) . size ( ) ) ; <END_BUG> ThreadPoolTaskExecutor taskExecutor = this . customContext . getBean ( "clientInboundChannelExecutor" , ThreadPoolTaskExecutor . class ) ; assertEquals ( 11 , taskExecutor . getCorePoolSize ( ) ) ; assertEquals ( 12 , taskExecutor . getMaxPoolSize ( ) ) ; assertEquals ( 13 , taskExecutor . getKeepAliveSeconds ( ) ) ; } @ Test public void clientOutboundChannelUsedByAnnotatedMethod ( ) { } @ Test public void clientOutboundChannelUsedBySimpleBroker ( ) { } @ Test public void clientOutboundChannelCustomized ( ) { } @ Test public void brokerChannel ( ) { } @ Test public void brokerChannelWithBrokerRelay ( ) { } @ Test public void brokerChannelUsedByAnnotatedMethod ( ) { } @ Test public void brokerChannelUsedByUserDestinationMessageHandler ( ) { } @ Test public void brokerChannelCustomized ( ) { } @ Test public void configureMessageConvertersDefault ( ) { } @ Test public void threadPoolSizeDefault ( ) { } @ Test public void configureMessageConvertersCustom ( ) { } @ Test public void configureMessageConvertersCustomAndDefault ( ) { } @ Test public void customArgumentAndReturnValueTypes ( ) throws Exception { } @ Test public void simpValidatorDefault ( ) { } @ Test public void simpValidatorCustom ( ) { } @ Test public void simpValidatorMvc ( ) { } @ Test public void simpValidatorInjected ( ) { } @ Test public void customPathMatcher ( ) { } @ Controller static class TestController { @ SubscribeMapping ( "//foo" ) public String handleSubscribe ( ) { } @ MessageMapping ( "//foo" ) @ SendTo ( "//bar" ) public String handleMessage ( ) { } } @ Configuration static class SimpleBrokerConfig extends AbstractMessageBrokerConfiguration { @ Bean public MessageBrokerConfigurationTests . TestController subscriptionController ( ) { } @ Override @ Bean public AbstractSubscribableChannel clientInboundChannel ( ) { } @ Override @ Bean public AbstractSubscribableChannel clientOutboundChannel ( ) { } @ Override @ Bean public AbstractSubscribableChannel brokerChannel ( ) { } } @ Configuration static class BrokerRelayConfig extends MessageBrokerConfigurationTests . SimpleBrokerConfig { @ Override public void configureMessageBroker ( MessageBrokerRegistry registry ) { } } @ Configuration static class DefaultConfig extends AbstractMessageBrokerConfiguration { } @ Configuration static class CustomConfig extends AbstractMessageBrokerConfiguration { private ChannelInterceptor interceptor = new ChannelInterceptorAdapter ( ) { } ; @ Override protected void configureClientInboundChannel ( ChannelRegistration registration ) { } @ Override protected void configureClientOutboundChannel ( ChannelRegistration registration ) { } @ Override protected void addArgumentResolvers ( List < HandlerMethodArgumentResolver > argumentResolvers ) { } @ Override protected void addReturnValueHandlers ( List < HandlerMethodReturnValueHandler > returnValueHandlers ) { } @ Override protected void configureMessageBroker ( MessageBrokerRegistry registry ) { } } private static class TestChannel extends ExecutorSubscribableChannel { private final List < Message < ? > > messages = new ArrayList < > ( ) ; @ Override public boolean sendInternal ( Message < ? > message , long timeout ) { } } private static class TestValidator implements Validator { @ Override public boolean supports ( Class < ? > clazz ) { } @ Override public void validate ( Object target , Errors errors ) { } } }

Fix:
assertEquals ( 2 , channel . getInterceptors ( ) . size ( ) ) ;