@Override
    protected MetaDataRegisterDTO buildMetaDataDTO(final ServiceFactoryBean serviceBean,
                                                   @NonNull final ShenyuSofaClient shenyuSofaClient,
                                                   final String superPath,
                                                   final Class<?> clazz,
                                                   final Method method) {
        String appName = this.getAppName();
        String contextPath = this.getContextPath();
        String path = pathJoin(contextPath, superPath, shenyuSofaClient.path());
        String serviceName = serviceBean.getInterfaceClass().getName();
        String desc = shenyuSofaClient.desc();
        String configRuleName = shenyuSofaClient.ruleName();
        String ruleName = StringUtils.isEmpty(configRuleName) ? path : configRuleName;
        String methodName = method.getName();
        String parameterTypes = Arrays.stream(method.getParameters())
                .map(parameter -> {
                    StringBuilder result = new StringBuilder(parameter.getType().getName());
                    final Type type = parameter.getParameterizedType();
                    if (type instanceof ParameterizedType) {
                        final Type[] actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
                        for (Type actualTypeArgument : actualTypeArguments) {
                            result.append("#").append(actualTypeArgument.getTypeName());
                        }
                    }
                    return result.toString();
                }).collect(Collectors.joining(","));
        return MetaDataRegisterDTO.builder()
                .appName(appName)
                .serviceName(serviceName)
                .methodName(methodName)
                .contextPath(contextPath)
                .host(super.getHost())
                .port(Integer.parseInt(getPort()))
                .path(path)
                .ruleName(ruleName)
                .pathDesc(desc)
                .parameterTypes(parameterTypes)
                .rpcType(RpcTypeEnum.SOFA.getName())
                .rpcExt(buildRpcExt(shenyuSofaClient))
                .enabled(shenyuSofaClient.enabled())
                .build();
    }
@Test
    public void testBuildMetaDataDTO() throws NoSuchMethodException {
        Method method = SofaServiceEventListener
                .class
                .getDeclaredMethod(METHOD_NAME, ApplicationContext.class, Map.class);
        given(shenyuSofaClient.path()).willReturn(PATH);
        given(shenyuSofaClient.desc()).willReturn(DESC);
        given(shenyuSofaClient.ruleName()).willReturn(CONFIG_RULE_NAME);
        given(shenyuSofaClient.loadBalance()).willReturn(LOAD_BALANCE);
        given(shenyuSofaClient.retries()).willReturn(RETRY_TIME);
        given(shenyuSofaClient.timeout()).willReturn(TIME_OUT);
        given(shenyuSofaClient.enabled()).willReturn(ENABLED);
        // The willReturn method cannot have the class<?> type as an input parameter.
        // Have raised the question in the Mockito community, will get back to this after getting answer
        doReturn(Comparable.class).when(serviceFactoryBean).getInterfaceClass();

        String expectedParameterTypes = "org.springframework.context.ApplicationContext,java.util.Map#java.lang.String#"
                + "com.alipay.sofa.runtime.spring.factory.ServiceFactoryBean";
        String expectedPath = "/sofa/findByIdsAndName/path";
        String expectedRpcExt = "{\"loadbalance\":\"loadBalance\",\"retries\":0,\"timeout\":0}";

        MetaDataRegisterDTO realMetaDataRegisterDTO = sofaServiceEventListener
                .buildMetaDataDTO(
                        serviceFactoryBean,
                        shenyuSofaClient,
                        SUPER_PATH_NOT_CONTAINS_STAR,
                        SofaServiceEventListener.class,
                        method);
        MetaDataRegisterDTO expectedMetaDataRegisterDTO = MetaDataRegisterDTO
                .builder()
                .appName(APP_NAME)
                .serviceName(SERVICE_NAME)
                .methodName(METHOD_NAME)
                .contextPath(CONTEXT_PATH)
                .host(HOST)
                .port(Integer.parseInt(PORT))
                .path(expectedPath)
                .ruleName(CONFIG_RULE_NAME)
                .pathDesc(DESC)
                .parameterTypes(expectedParameterTypes)
                .rpcType(RpcTypeEnum.SOFA.getName())
                .rpcExt(expectedRpcExt)
                .enabled(ENABLED)
                .build();

        assertEquals(expectedMetaDataRegisterDTO, realMetaDataRegisterDTO);
    }