Search in sources :

Example 6 with MethodRecorder

use of org.jacoco.core.instr.MethodRecorder in project jacoco by jacoco.

the class MethodSanitizerTest method dump.

private MethodRecorder dump(MethodNode node) {
    MethodRecorder rec = new MethodRecorder();
    node.accept(rec.getVisitor());
    return rec;
}
Also used : MethodRecorder(org.jacoco.core.instr.MethodRecorder)

Example 7 with MethodRecorder

use of org.jacoco.core.instr.MethodRecorder in project jacoco by jacoco.

the class MethodInstrumenterTest method setup.

@Before
public void setup() {
    actual = new MethodRecorder();
    expected = new MethodRecorder();
    expectedVisitor = expected.getVisitor();
    final IProbeInserter probeInserter = new IProbeInserter() {

        public void insertProbe(int id) {
            actual.getVisitor().visitLdcInsn("Probe " + id);
        }
    };
    instrumenter = new MethodInstrumenter(actual.getVisitor(), probeInserter);
    frame = new IFrame() {

        public void accept(MethodVisitor mv) {
            mv.visitFrame(Opcodes.F_FULL, 0, null, 0, null);
        }
    };
}
Also used : IFrame(org.jacoco.core.internal.flow.IFrame) MethodRecorder(org.jacoco.core.instr.MethodRecorder) MethodVisitor(org.objectweb.asm.MethodVisitor) Before(org.junit.Before)

Example 8 with MethodRecorder

use of org.jacoco.core.instr.MethodRecorder in project jacoco by jacoco.

the class ProbeInserterTest method setup.

@Before
public void setup() {
    actual = new MethodRecorder();
    actualVisitor = actual.getVisitor();
    expected = new MethodRecorder();
    expectedVisitor = expected.getVisitor();
    arrayStrategy = new IProbeArrayStrategy() {

        public int storeInstance(MethodVisitor mv, boolean clinit, int variable) {
            mv.visitLdcInsn(clinit ? "clinit" : "init");
            return 5;
        }

        public void addMembers(ClassVisitor delegate, int probeCount) {
        }
    };
}
Also used : MethodRecorder(org.jacoco.core.instr.MethodRecorder) ClassVisitor(org.objectweb.asm.ClassVisitor) MethodVisitor(org.objectweb.asm.MethodVisitor) Before(org.junit.Before)

Aggregations

MethodRecorder (org.jacoco.core.instr.MethodRecorder)8 Before (org.junit.Before)5 MethodVisitor (org.objectweb.asm.MethodVisitor)3 AnalyzerAdapter (org.objectweb.asm.commons.AnalyzerAdapter)2 IFrame (org.jacoco.core.internal.flow.IFrame)1 After (org.junit.After)1 Test (org.junit.Test)1 ClassVisitor (org.objectweb.asm.ClassVisitor)1 Label (org.objectweb.asm.Label)1