@Override
    public void register(final String key, final String value) {
        try {
            Instance instance = buildInstanceFromUpstream(key, value);
            namingService.registerInstance(key, groupName, instance);
            LOGGER.info("Registering service with key: {} and value: {}", key, value);
        } catch (NacosException nacosException) {
            LOGGER.error("Error registering Nacos service instance: {}", nacosException.getMessage(), nacosException);
            throw new ShenyuException(nacosException);
        }
    }
@Test
    void testRegister() throws NacosException {
        final String key = "test";
        final String value = "{\"weight\":20,\"url\":\"127.0.0.1:8080\"}";

        doNothing().when(namingService).registerInstance(anyString(), anyString(), any(Instance.class));
        nacosDiscoveryServiceUnderTest.register(key, value);
        // Verify whether the method is called correctly
        verify(namingService).registerInstance(anyString(), anyString(), any(Instance.class));
        // Mock the wrong json format
        assertThrows(ShenyuException.class, () -> nacosDiscoveryServiceUnderTest.register(key, "test"));
        // Mock the throwing of registerInstance exception
        doThrow(new NacosException()).when(namingService).registerInstance(anyString(), anyString(), any(Instance.class));
        assertThrows(ShenyuException.class, () -> nacosDiscoveryServiceUnderTest.register(key, value));
    }