@SuppressWarnings("unchecked")
    public <T> T convert(DocString docString, Type targetType) {
        if (DocString.class.equals(targetType)) {
            return (T) docString;
        }

        List<DocStringType> docStringTypes = docStringTypeRegistry.lookup(docString.getContentType(), targetType);

        if (docStringTypes.isEmpty()) {
            if (docString.getContentType() == null) {
                throw new CucumberDocStringException(format(
                    "It appears you did not register docstring type for %s",
                    targetType.getTypeName()));
            }
            throw new CucumberDocStringException(format(
                "It appears you did not register docstring type for '%s' or %s",
                docString.getContentType(),
                targetType.getTypeName()));
        }
        if (docStringTypes.size() > 1) {
            List<String> suggestedContentTypes = suggestedContentTypes(docStringTypes);
            if (docString.getContentType() == null) {
                throw new CucumberDocStringException(format(
                    "Multiple converters found for type %s, add one of the following content types to your docstring %s",
                    targetType.getTypeName(),
                    suggestedContentTypes));
            }
            throw new CucumberDocStringException(format(
                "Multiple converters found for type %s, and the content type '%s' did not match any of the registered types %s. Change the content type of the docstring or register a docstring type for '%s'",
                targetType.getTypeName(),
                docString.getContentType(),
                suggestedContentTypes,
                docString.getContentType()));
        }

        return (T) docStringTypes.get(0).transform(docString.getContent());
    }
@Test
    void anonymous_to_string_uses_default() {
        DocString docString = DocString.create("hello world");
        assertThat(converter.convert(docString, String.class), is("hello world"));
    }