aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java')
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
index 6ce99ed7..1dc5fc2c 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
@@ -12,9 +12,12 @@
package org.jacoco.core.internal.flow;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
import org.junit.Before;
import org.junit.Test;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.tree.InsnNode;
/**
* Unit tests for {@link Instruction}.
@@ -25,11 +28,14 @@ public class InstructionTest {
@Before
public void setup() {
- instruction = new Instruction(123);
+ instruction = new Instruction(new InsnNode(Opcodes.NOP), 123);
}
@Test
public void testInit() {
+ final InsnNode node = new InsnNode(Opcodes.NOP);
+ instruction = new Instruction(node, 123);
+ assertSame(node, instruction.getNode());
assertEquals(123, instruction.getLine());
assertEquals(0, instruction.getBranches());
assertEquals(0, instruction.getCoveredBranches());
@@ -48,14 +54,16 @@ public class InstructionTest {
@Test
public void testSetPredecessor() {
- final Instruction predecessor = new Instruction(122);
+ final Instruction predecessor = new Instruction(
+ new InsnNode(Opcodes.NOP), 122);
instruction.setPredecessor(predecessor);
assertEquals(1, predecessor.getBranches());
}
@Test
public void testSetCovered() {
- final Instruction predecessor = new Instruction(122);
+ final Instruction predecessor = new Instruction(
+ new InsnNode(Opcodes.NOP), 122);
instruction.setPredecessor(predecessor);
instruction.setCovered();
assertEquals(1, instruction.getCoveredBranches());
@@ -68,10 +76,11 @@ public class InstructionTest {
@Test
public void testSetCoveredOnLongSequence() {
- final Instruction first = new Instruction(0);
+ final Instruction first = new Instruction(new InsnNode(Opcodes.NOP), 0);
Instruction next = first;
for (int i = 0; i < 0x10000; i++) {
- final Instruction insn = new Instruction(i);
+ final Instruction insn = new Instruction(new InsnNode(Opcodes.NOP),
+ i);
insn.setPredecessor(next);
next = insn;
}