### Question:
RqueueListenerBaseConfig { protected RqueueMessageTemplate getMessageTemplate(RqueueConfig rqueueConfig) { if (simpleRqueueListenerContainerFactory.getRqueueMessageTemplate() != null) { return simpleRqueueListenerContainerFactory.getRqueueMessageTemplate(); } simpleRqueueListenerContainerFactory.setRqueueMessageTemplate( new RqueueMessageTemplateImpl(rqueueConfig.getConnectionFactory())); return simpleRqueueListenerContainerFactory.getRqueueMessageTemplate(); }  @Bean RqueueConfig rqueueConfig(
      ConfigurableBeanFactory beanFactory,
      @Value("${rqueue.version.key:__rq::version}") String versionKey,
      @Value("${rqueue.db.version:}") Integer dbVersion); @Bean RqueueWebConfig rqueueWebConfig(); @Bean RqueueSchedulerConfig rqueueSchedulerConfig(); @Bean RedisTemplate<String, Long> rqueueRedisLongTemplate(RqueueConfig rqueueConfig); @Bean RqueueRedisListenerContainerFactory rqueueRedisListenerContainerFactory(); @Bean DelayedMessageScheduler delayedMessageScheduler(); @Bean ProcessingMessageScheduler processingMessageScheduler(); @Bean RqueueRedisTemplate<String> stringRqueueRedisTemplate(RqueueConfig rqueueConfig); @Bean RqueueLockManager rqueueLockManager(
      @Qualifier("stringRqueueRedisTemplate") RqueueRedisTemplate<String> rqueueRedisTemplate); @Bean JtwigViewResolver rqueueViewResolver(); static final int MAX_DB_VERSION; }### Answer:
@Test public void testGetMessageTemplateUseFromFactory() throws IllegalAccessException { SimpleRqueueListenerContainerFactory factory = new SimpleRqueueListenerContainerFactory(); RqueueListenerConfig rqueueListenerConfig = createConfig(factory); RqueueConfig rqueueConfig = new RqueueConfig(redisConnectionFactory, false, 1); factory.setRqueueMessageTemplate(rqueueMessageTemplate); assertEquals(rqueueMessageTemplate, rqueueListenerConfig.getMessageTemplate(rqueueConfig)); }
@Test public void testGetMessageTemplateSetTemplateInFactory() throws IllegalAccessException { SimpleRqueueListenerContainerFactory factory = new SimpleRqueueListenerContainerFactory(); RqueueListenerConfig rqueueListenerConfig = createConfig(factory); RqueueConfig rqueueConfig = new RqueueConfig(redisConnectionFactory, false, 1); RqueueMessageTemplate template = rqueueListenerConfig.getMessageTemplate(rqueueConfig); assertNotNull(template); assertEquals(template, factory.getRqueueMessageTemplate()); }