@Override
    public ExecuteContext doBefore(ExecuteContext context) {
        String serviceId = (String) context.getArguments()[0];
        final RegisterCenterService service = PluginServiceManager.getPluginService(RegisterCenterService.class);
        final List<MicroServiceInstance> microServiceInstances = service.getServerList(serviceId);
        if (microServiceInstances.isEmpty()) {
            return context;
        }
        context.setLocalFieldValue(SERVICE_ID, serviceId);
        context.setLocalFieldValue(MICRO_SERVICE_INSTANCES, microServiceInstances);
        if (RegisterContext.INSTANCE.isAvailable()
                && !RegisterDynamicConfig.INSTANCE.isNeedCloseOriginRegisterCenter()) {
            return context;
        }
        final Object target = context.getObject();
        context.skip(isWebfLux(target) ? Flux.fromIterable(Collections.emptyList())
                : Collections.emptyList());
        return context;
    }
@Test
    public void doBefore() throws NoSuchMethodException {
        Mockito.when(registerCenterService.getServerList(serviceName)).thenReturn(instanceList);

        // A normal scenario where isEmpty is false and isAvailable is true
        RegisterContext.INSTANCE.setAvailable(true);
        REGISTER_CONFIG.setEnableSpringRegister(true);
        REGISTER_CONFIG.setOpenMigration(true);
        RegisterDynamicConfig.INSTANCE.setClose(false);
        final ExecuteContext context = interceptor.doBefore(
                buildContext(client, new Object[]{serviceName}, zkInstanceList));
        final ExecuteContext contextResult = interceptor.doAfter(context);
        Assert.assertTrue(contextResult.getResult() instanceof List);
        Assert.assertEquals(((List<?>) contextResult.getResult()).size(), zkInstanceList.size() + instanceList.size());

        // IsWebfLux scenario where isEmpty is false and isAvailable is true
        final ExecuteContext fluxContext = interceptor.doBefore(buildContext(reactiveDiscoveryClient,
                new Object[]{serviceName}, Flux.fromIterable(zkInstanceList)));
        final ExecuteContext fluxContextResult = interceptor.doAfter(fluxContext);
        Assert.assertTrue(fluxContextResult.getResult() instanceof Flux);
        final List<?> block = ((Flux<?>) fluxContextResult.getResult()).collectList().block();
        Assert.assertNotNull(block);
        Assert.assertEquals(block.size(), zkInstanceList.size() + instanceList.size());

        // Scenario where isEmpty is false and isAvailable is false
        RegisterContext.INSTANCE.setAvailable(false);
        final ExecuteContext notAvailableContext = interceptor.doBefore(
                buildContext(client, new Object[]{serviceName}, zkInstanceList));
        Assert.assertTrue(notAvailableContext.isSkip());
        Assert.assertTrue(CollectionUtils.isEmpty((Collection<?>) notAvailableContext.getResult()));
        final ExecuteContext notAvailableContextResult = interceptor.doAfter(notAvailableContext);
        Assert.assertTrue(notAvailableContextResult.getResult() instanceof List);
        Assert.assertEquals(((List<?>) notAvailableContextResult.getResult()).size(), instanceList.size());

        // Scenario where isEmpty is true and isAvailable is true
        RegisterContext.INSTANCE.setAvailable(true);
        Mockito.when(registerCenterService.getServerList(serviceName)).thenReturn(Collections.emptyList());
        final ExecuteContext contextWithEmptyList = interceptor.doBefore(
                buildContext(client, new Object[]{serviceName}, zkInstanceList));
        final ExecuteContext contextWithEmptyListResult = interceptor.doAfter(contextWithEmptyList);
        Assert.assertTrue(contextWithEmptyListResult.getResult() instanceof List);
        Assert.assertEquals(((List<?>) contextWithEmptyListResult.getResult()).size(), zkInstanceList.size());

        // Scenario where isEmpty is true and isAvailable is false
        Mockito.when(registerCenterService.getServerList(serviceName)).thenReturn(Collections.emptyList());
        final ExecuteContext contextWithEmptyListx = interceptor.doBefore(
                buildContext(client, new Object[]{serviceName}, zkInstanceList));
        final ExecuteContext contextWithEmptyListResultx = interceptor.doAfter(contextWithEmptyListx);
        Assert.assertTrue(contextWithEmptyListResultx.getResult() instanceof List);
        Assert.assertEquals(((List<?>) contextWithEmptyListResultx.getResult()).size(), zkInstanceList.size());

        REGISTER_CONFIG.setEnableSpringRegister(false);
        REGISTER_CONFIG.setOpenMigration(false);
    }