@Override
    public ReferenceConfig<T> build() {
        ReferenceConfig<T> reference = new ReferenceConfig<>();
        super.build(reference);

        reference.setInterface(interfaceName);
        if (interfaceClass != null) {
            reference.setInterface(interfaceClass);
        }
        reference.setClient(client);
        reference.setUrl(url);
        reference.setMethods(methods);
        reference.setConsumer(consumer);
        reference.setProtocol(protocol);
        // @since 2.7.8
        reference.setServices(services);

        return reference;
    }
@Test
    void build() {
        ConsumerConfig consumer = new ConsumerConfig();
        MethodConfig method = new MethodConfig();

        ReferenceBuilder<DemoService> builder = new ReferenceBuilder<>();
        builder.id("id")
                .interfaceClass(DemoService.class)
                .protocol("protocol")
                .client("client")
                .url("url")
                .consumer(consumer)
                .addMethod(method)
                // introduced since 2.7.8
                .services("test-service", "test-service2");

        ReferenceConfig config = builder.build();
        ReferenceConfig config2 = builder.build();

        Assertions.assertEquals("org.apache.dubbo.config.api.DemoService", config.getInterface());
        Assertions.assertEquals(DemoService.class, config.getInterfaceClass());
        Assertions.assertEquals("protocol", config.getProtocol());
        Assertions.assertEquals("client", config.getClient());
        Assertions.assertEquals("url", config.getUrl());
        Assertions.assertEquals(consumer, config.getConsumer());
        Assertions.assertEquals("test-service,test-service2", config.getServices());
        Assertions.assertEquals(ofSet("test-service", "test-service2"), config.getSubscribedServices());
        Assertions.assertTrue(config.getMethods().contains(method));
        Assertions.assertEquals(1, config.getMethods().size());
        Assertions.assertNotSame(config, config2);
    }