public static void updateInstanceMetadata(Instance instance, InstanceMetadata metadata) {
        instance.setEnabled(metadata.isEnabled());
        instance.setWeight(metadata.getWeight());
        for (Map.Entry<String, Object> entry : metadata.getExtendData().entrySet()) {
            instance.getMetadata().put(entry.getKey(), entry.getValue().toString());
        }
    }
@Test
    void testUpdateInstanceMetadata() {
        InstanceMetadata metaData = new InstanceMetadata();
        Map<String, Object> extendData = new ConcurrentHashMap<>(1);
        extendData.put("k1", "v1");
        extendData.put("k2", "v2");
        metaData.setExtendData(extendData);
        metaData.setEnabled(true);
        metaData.setWeight(1);
        Instance instance = InstanceUtil.parseToApiInstance(service, instancePublishInfo);
        
        InstanceUtil.updateInstanceMetadata(instance, metaData);
        assertNotNull(instance.getMetadata());
        assertEquals(2, metaData.getExtendData().size());
    }