@Test
    public void WhenLevelBiggerThanRefMax_ExpectFinalSizeEqualToRefMax() throws UnknownHostException {
        int refMax = 1;
        Host localhost = new PGridHost("127.0.0.1", 3000);
        localhost.setHostPath("0010");
        RoutingTable routingTable = new RoutingTable();
        routingTable.setLocalhost(localhost);

        Host host1 = new PGridHost("127.0.0.1", 1111);
        host1.setHostPath("1");
        Host host2 = new PGridHost("127.0.0.1", 2222);
        host2.setHostPath("01");
        Host host3 = new PGridHost("127.0.0.1", 3333);
        host3.setHostPath("0000");
        Host host4 = new PGridHost("127.0.0.1", 4444);
        host4.setHostPath("0001");
        Host host5 = new PGridHost("127.0.0.1", 5555);
        host5.setHostPath("00110");
        Host host6 = new PGridHost("127.0.0.1", 6666);
        host6.setHostPath("00111");

        routingTable.addReference(0, host1);
        routingTable.addReference(1, host2);
        routingTable.addReference(2, host3);
        routingTable.addReference(2, host4);
        routingTable.addReference(3, host5);
        routingTable.addReference(3, host6);

        routingTable.refresh(refMax);

        int expectedLevels = 4;
        int expected0levelSize = 1; // "1"
        int expected1levelSize = 1; // "01"
        int expected2levelSize = 1; // "000"
        int expected3levelSize = 1; // "0011"

        Assert.assertTrue(routingTable.levelNumber() == expectedLevels);
        Assert.assertTrue(routingTable.getLevel(0).size() == expected0levelSize);
        Assert.assertTrue(routingTable.getLevel(1).size() == expected1levelSize);
        Assert.assertTrue(routingTable.getLevel(2).size() == expected2levelSize);
        Assert.assertTrue(routingTable.getLevel(3).size() == expected3levelSize);

        Assert.assertTrue(routingTable.getLevel(0).contains(host1));
        Assert.assertTrue(routingTable.getLevel(1).contains(host2));

        Assert.assertTrue(routingTable.getLevel(2).contains(host3) || routingTable.getLevel(2).contains(host4));
        Assert.assertFalse(routingTable.getLevel(2).contains(host3) && routingTable.getLevel(2).contains(host4));

        Assert.assertTrue(routingTable.getLevel(3).contains(host5) || routingTable.getLevel(3).contains(host6));
        Assert.assertFalse(routingTable.getLevel(3).contains(host5) && routingTable.getLevel(3).contains(host6));
    }