@Test
public void testHandlerMerge_MergeSame() {
TryListBuilder tlb = new TryListBuilder();
tlb.addHandler(0, 15, new ImmutableExceptionHandler(null, 6));
tlb.addHandler(10, 20, new ImmutableExceptionHandler("LException1;", 5));
tlb.addHandler(20, 30, new ImmutableExceptionHandler("LException1;", 5));
tlb.addHandler(25, 40, new ImmutableExceptionHandler(null, 6));
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = tlb.getTryBlocks();
List<? extends TryBlock> expected = ImmutableList.of(
new ImmutableTryBlock(0, 10,
ImmutableList.of(
new ImmutableExceptionHandler(null, 6))),
new ImmutableTryBlock(10, 5,
ImmutableList.of(
new ImmutableExceptionHandler(null, 6),
new ImmutableExceptionHandler("LException1;", 5))),
new ImmutableTryBlock(15, 10,
ImmutableList.of(
new ImmutableExceptionHandler("LException1;", 5))),
new ImmutableTryBlock(25, 5,
ImmutableList.of(
new ImmutableExceptionHandler("LException1;", 5),
new ImmutableExceptionHandler(null, 6))),
new ImmutableTryBlock(30, 10,
ImmutableList.of(
new ImmutableExceptionHandler(null, 6))));
Assert.assertEquals(expected, tryBlocks);
}