public static ServiceInstance toServiceInstance(URL registryUrl, Instance instance) {
        DefaultServiceInstance serviceInstance = new DefaultServiceInstance(
                NamingUtils.getServiceName(instance.getServiceName()),
                instance.getIp(),
                instance.getPort(),
                ScopeModelUtil.getApplicationModel(registryUrl.getScopeModel()));
        serviceInstance.setMetadata(instance.getMetadata());
        serviceInstance.setEnabled(instance.isEnabled());
        serviceInstance.setHealthy(instance.isHealthy());
        return serviceInstance;
    }
@Test
    void testToServiceInstance() {
        URL registryUrl = URL.valueOf("test://test:8080/test");
        Instance instance = new Instance();
        instance.setServiceName("serviceName");
        instance.setIp("1.1.1.1");
        instance.setPort(800);
        instance.setWeight(2);
        instance.setHealthy(Boolean.TRUE);
        instance.setEnabled(Boolean.TRUE);
        Map<String, String> map = new HashMap<String, String>();
        map.put("netType", "external");
        map.put("version", "2.0");
        instance.setMetadata(map);

        ServiceInstance serviceInstance = NacosNamingServiceUtils.toServiceInstance(registryUrl, instance);
        Assertions.assertNotNull(serviceInstance);
        Assertions.assertEquals(serviceInstance.isEnabled(), Boolean.TRUE);
        Assertions.assertEquals(serviceInstance.getServiceName(), "serviceName");
    }