@Override
    public void export(RegisterTypeEnum registerType) {
        if (this.exported) {
            return;
        }

        if (getScopeModel().isLifeCycleManagedExternally()) {
            // prepare model for reference
            getScopeModel().getDeployer().prepare();
        } else {
            // ensure start module, compatible with old api usage
            getScopeModel().getDeployer().start();
        }

        synchronized (this) {
            if (this.exported) {
                return;
            }

            if (!this.isRefreshed()) {
                this.refresh();
            }
            if (this.shouldExport()) {
                this.init();

                if (shouldDelay()) {
                    // should register if delay export
                    doDelayExport();
                } else if (Integer.valueOf(-1).equals(getDelay())
                        && Boolean.parseBoolean(ConfigurationUtils.getProperty(
                                getScopeModel(), CommonConstants.DUBBO_MANUAL_REGISTER_KEY, "false"))) {
                    // should not register by default
                    doExport(RegisterTypeEnum.MANUAL_REGISTER);
                } else {
                    doExport(registerType);
                }
            }
        }
    }
@Test
    void testMethodConfigWithInvalidArgumentConfig() {
        Assertions.assertThrows(IllegalArgumentException.class, () -> {
            ServiceConfig<DemoServiceImpl> service = new ServiceConfig<>();

            service.setInterface(DemoService.class);
            service.setRef(new DemoServiceImpl());
            service.setProtocol(new ProtocolConfig() {
                {
                    setName("dubbo");
                }
            });

            MethodConfig methodConfig = new MethodConfig();
            methodConfig.setName("sayName");
            // invalid argument index.
            methodConfig.setArguments(Lists.newArrayList(new ArgumentConfig() {
                {
                    // unset config.
                }
            }));
            service.setMethods(Lists.newArrayList(methodConfig));

            service.export();
        });
    }