Skip to content

Commit

Permalink
Add test for drain stack underflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jan 14, 2022
1 parent a8e8098 commit 16b5857
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -63,6 +63,13 @@ public void testDrainOrder() throws Exception {
verifyNoMoreInteractions(this.methodVisitor);
}

@Test
public void testDrainStackWithUnderflow() {
StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor(this.methodVisitor, methodDescription);
assertThat(methodVisitor.drainStack(Opcodes.ISTORE, Opcodes.ILOAD, StackSize.SINGLE), is(0));
verifyZeroInteractions(this.methodVisitor);
}

@Test
public void testDrainRetainTopSingle() throws Exception {
when(methodDescription.getStackSize()).thenReturn(42);
Expand Down

0 comments on commit 16b5857

Please sign in to comment.