@Override
    public void registerService(String serviceName, String groupName, Instance instance) throws NacosException {
        NAMING_LOGGER.info("[REGISTER-SERVICE] {} registering service {} with instance {}", namespaceId, serviceName,
                instance);
        if (instance.isEphemeral()) {
            registerServiceForEphemeral(serviceName, groupName, instance);
        } else {
            doRegisterServiceForPersistent(serviceName, groupName, instance);
        }
    }
@Test
    void testRegisterServiceThrowsException() throws NacosException {
        Throwable exception = assertThrows(NacosException.class, () -> {
            
            when(this.rpcClient.request(Mockito.any())).thenReturn(null);
            
            try {
                client.registerService(SERVICE_NAME, GROUP_NAME, instance);
            } catch (NacosException ex) {
                assertEquals(NullPointerException.class, ex.getCause().getClass());
                
                throw ex;
            }
        });
        assertTrue(exception.getMessage().contains("Request nacos server failed: "));
    }