@@ -0,0 +1,1308 @@
+package com.github.phantomthief.failover.util;%0A%0Aimport static java.util.Collections.singleton;%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0Aimport static org.junit.jupiter.api.Assertions.assertTrue;%0A%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport com.google.common.collect.HashMultiset;%0Aimport com.google.common.collect.Multiset;%0A%0A/**%0A * @author w.vela%0A * Created on 2019-01-04.%0A */%0Aclass WeightTest %7B%0A%0A    @Test%0A    void test() %7B%0A        Weight%3CString%3E weight = new Weight%3CString%3E() //%0A                .add(%22s1%22, 1) //%0A                .add(%22s2%22, 2) //%0A                .add(%22s3%22, 3);%0A        Multiset%3CString%3E result = HashMultiset.create();%0A        for (int i = 0; i %3C 10000; i++) %7B%0A            result.add(weight.get());%0A        %7D%0A        assertTrue(between((double) result.count(%22s2%22) / result.count(%22s1%22), 1.8, 2.2));%0A        assertTrue(between((double) result.count(%22s3%22) / result.count(%22s1%22), 2.8, 3.2));%0A%0A        result.clear();%0A%0A        for (int i = 0; i %3C 10000; i++) %7B%0A            result.add(weight.getWithout(singleton(%22s3%22)));%0A        %7D%0A        assertTrue(between((double) result.count(%22s2%22) / result.count(%22s1%22), 1.8, 2.2));%0A        assertEquals(0, result.count(%22s3%22));%0A    %7D%0A%0A    private boolean between(double k, double min, double max) %7B%0A        return min %3C= k && k %3C= max;%0A    %7D%0A%7D

add weight test.