@Test
  public void messageConvertersDefaultsOff() {
    loadBeanDefinitions("websocket-config-broker-converters-defaults-off.xml");

    CompositeMessageConverter compositeConverter =
        this.appContext.getBean(CompositeMessageConverter.class);
    assertNotNull(compositeConverter);

    assertEquals(1, compositeConverter.getConverters().size());
    assertEquals(
        StringMessageConverter.class,
        compositeConverter.getConverters().iterator().next().getClass());
  }
  @Test
  public void addCustomConverter() {
    List<?> customMessageConverters = context.getBean("customMessageConverters", List.class);

    assertEquals(1, customMessageConverters.size());

    ModuleTypeConversionPlugin plugin = context.getBean(ModuleTypeConversionPlugin.class);

    CompositeMessageConverterFactory factory =
        (CompositeMessageConverterFactory) TestUtils.getPropertyValue(plugin, "converterFactory");
    CompositeMessageConverter converters =
        factory.newInstance(MimeType.valueOf("application/x-xd-foo"));
    assertEquals(1, converters.getConverters().size());
    assertTrue(converters.getConverters().iterator().next() instanceof StubPojoToStringConverter);
  }
  @Test
  public void annotationMethodMessageHandler() {
    loadBeanDefinitions("websocket-config-broker-simple.xml");

    SimpAnnotationMethodMessageHandler annotationMethodMessageHandler =
        this.appContext.getBean(SimpAnnotationMethodMessageHandler.class);

    assertNotNull(annotationMethodMessageHandler);
    MessageConverter messageConverter = annotationMethodMessageHandler.getMessageConverter();
    assertNotNull(messageConverter);
    assertTrue(messageConverter instanceof CompositeMessageConverter);

    CompositeMessageConverter compositeMessageConverter =
        this.appContext.getBean(CompositeMessageConverter.class);
    assertNotNull(compositeMessageConverter);

    SimpMessagingTemplate simpMessagingTemplate =
        this.appContext.getBean(SimpMessagingTemplate.class);
    assertNotNull(simpMessagingTemplate);
    assertEquals("/personal/", simpMessagingTemplate.getUserDestinationPrefix());

    List<MessageConverter> converters = compositeMessageConverter.getConverters();
    assertThat(converters.size(), Matchers.is(3));
    assertThat(converters.get(0), Matchers.instanceOf(StringMessageConverter.class));
    assertThat(converters.get(1), Matchers.instanceOf(ByteArrayMessageConverter.class));
    assertThat(converters.get(2), Matchers.instanceOf(MappingJackson2MessageConverter.class));

    ContentTypeResolver resolver =
        ((MappingJackson2MessageConverter) converters.get(2)).getContentTypeResolver();
    assertEquals(
        MimeTypeUtils.APPLICATION_JSON,
        ((DefaultContentTypeResolver) resolver).getDefaultMimeType());

    DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(annotationMethodMessageHandler);
    String pathSeparator =
        (String)
            new DirectFieldAccessor(handlerAccessor.getPropertyValue("pathMatcher"))
                .getPropertyValue("pathSeparator");
    assertEquals(".", pathSeparator);
  }