use of org.jf.dexlib2.immutable.ImmutableTryBlock in project smali by JesusFreke.
the class TryListBuilderTest method testOverlap_Before_Middle.
@Test
public void testOverlap_Before_Middle() {
TryListBuilder tlb = new TryListBuilder();
tlb.addHandler(5, 10, new ImmutableExceptionHandler("LException1;", 5));
tlb.addHandler(0, 7, new ImmutableExceptionHandler("LException2;", 6));
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = tlb.getTryBlocks();
List<? extends TryBlock> expected = ImmutableList.of(new ImmutableTryBlock(0, 5, ImmutableList.of(new ImmutableExceptionHandler("LException2;", 6))), new ImmutableTryBlock(5, 2, ImmutableList.of(new ImmutableExceptionHandler("LException1;", 5), new ImmutableExceptionHandler("LException2;", 6))), new ImmutableTryBlock(7, 3, ImmutableList.of(new ImmutableExceptionHandler("LException1;", 5))));
Assert.assertEquals(expected, tryBlocks);
}
use of org.jf.dexlib2.immutable.ImmutableTryBlock in project smali by JesusFreke.
the class TryListBuilderTest method testHandlerMerge_Same.
@Test
public void testHandlerMerge_Same() {
TryListBuilder tlb = new TryListBuilder();
tlb.addHandler(5, 10, new ImmutableExceptionHandler("LException1;", 5));
tlb.addHandler(0, 15, new ImmutableExceptionHandler("LException1;", 5));
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = tlb.getTryBlocks();
List<? extends TryBlock> expected = ImmutableList.of(new ImmutableTryBlock(0, 15, ImmutableList.of(new ImmutableExceptionHandler("LException1;", 5))));
Assert.assertEquals(expected, tryBlocks);
}
use of org.jf.dexlib2.immutable.ImmutableTryBlock in project smali by JesusFreke.
the class TryListBuilderTest method testOverlap_Before_After.
@Test
public void testOverlap_Before_After() {
TryListBuilder tlb = new TryListBuilder();
tlb.addHandler(5, 10, new ImmutableExceptionHandler("LException1;", 5));
tlb.addHandler(0, 15, new ImmutableExceptionHandler("LException2;", 6));
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = tlb.getTryBlocks();
List<? extends TryBlock> expected = ImmutableList.of(new ImmutableTryBlock(0, 5, ImmutableList.of(new ImmutableExceptionHandler("LException2;", 6))), new ImmutableTryBlock(5, 5, ImmutableList.of(new ImmutableExceptionHandler("LException1;", 5), new ImmutableExceptionHandler("LException2;", 6))), new ImmutableTryBlock(10, 5, ImmutableList.of(new ImmutableExceptionHandler("LException2;", 6))));
Assert.assertEquals(expected, tryBlocks);
}
use of org.jf.dexlib2.immutable.ImmutableTryBlock in project smali by JesusFreke.
the class TryListBuilderTest method testOverlap_Middle_After.
@Test
public void testOverlap_Middle_After() {
TryListBuilder tlb = new TryListBuilder();
tlb.addHandler(0, 10, new ImmutableExceptionHandler("LException1;", 5));
tlb.addHandler(5, 15, new ImmutableExceptionHandler("LException2;", 6));
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = tlb.getTryBlocks();
List<? extends TryBlock> expected = ImmutableList.of(new ImmutableTryBlock(0, 5, ImmutableList.of(new ImmutableExceptionHandler("LException1;", 5))), new ImmutableTryBlock(5, 5, ImmutableList.of(new ImmutableExceptionHandler("LException1;", 5), new ImmutableExceptionHandler("LException2;", 6))), new ImmutableTryBlock(10, 5, ImmutableList.of(new ImmutableExceptionHandler("LException2;", 6))));
Assert.assertEquals(expected, tryBlocks);
}
use of org.jf.dexlib2.immutable.ImmutableTryBlock in project smali by JesusFreke.
the class TryListBuilderTest method testHandlerMerge_Catchall_Catchall.
@Test
public void testHandlerMerge_Catchall_Catchall() {
TryListBuilder tlb = new TryListBuilder();
tlb.addHandler(5, 10, new ImmutableExceptionHandler(null, 5));
tlb.addHandler(0, 15, new ImmutableExceptionHandler(null, 5));
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = tlb.getTryBlocks();
List<? extends TryBlock> expected = ImmutableList.of(new ImmutableTryBlock(0, 15, ImmutableList.of(new ImmutableExceptionHandler(null, 5))));
Assert.assertEquals(expected, tryBlocks);
}
Aggregations