double DELTA = 0;
List<Allocation> allocations = fromCompactAllocationFormat("ruleA|10:0,11:0.5,12:0.5", "0:0,1:0.5,2:0.5");
assertEquals(2, allocations.size());
{
Allocation allocationA = allocations.get(0);
assertEquals("ruleA", allocationA.getRule());
assertEquals(3, allocationA.getRanges().size());
assertEquals(10, allocationA.getRanges().get(0).getBucketValue());
assertEquals(0, allocationA.getRanges().get(0).getLength(), DELTA);
assertEquals(11, allocationA.getRanges().get(1).getBucketValue());
assertEquals(0.5, allocationA.getRanges().get(1).getLength(), DELTA);
assertEquals(12, allocationA.getRanges().get(2).getBucketValue());
assertEquals(0.5, allocationA.getRanges().get(2).getLength(), DELTA);
}
{
Allocation allocationB = allocations.get(1);
assertNull(allocationB.getRule());
assertEquals(3, allocationB.getRanges().size());
assertEquals(0, allocationB.getRanges().get(0).getBucketValue());
assertEquals(0, allocationB.getRanges().get(0).getLength(), DELTA);
assertEquals(1, allocationB.getRanges().get(1).getBucketValue());
assertEquals(0.5, allocationB.getRanges().get(1).getLength(), DELTA);
assertEquals(2, allocationB.getRanges().get(2).getBucketValue());
assertEquals(0.5, allocationB.getRanges().get(2).getLength(), DELTA);
}
}