@Override
    public String getTargetName(final String groupName, final List<String> availableTargetNames) {
        double[] weight = weightMap.containsKey(groupName) && weightMap.get(groupName).length == availableTargetNames.size() ? weightMap.get(groupName) : initWeight(availableTargetNames);
        weightMap.put(groupName, weight);
        return getAvailableTargetName(availableTargetNames, weight);
    }
@Test
    void assertGetAvailableTargetNameWhenTargetChanged() {
        LoadBalanceAlgorithm loadBalanceAlgorithm = TypedSPILoader.getService(LoadBalanceAlgorithm.class,
                "WEIGHT", PropertiesBuilder.build(new Property("test_read_ds_1", "5"), new Property("test_read_ds_2", "5")));
        loadBalanceAlgorithm.getTargetName("ds", Arrays.asList("test_read_ds_1", "test_read_ds_1"));
        assertThat(loadBalanceAlgorithm.getTargetName("ds", Collections.singletonList("test_read_ds_1")), is("test_read_ds_1"));
    }