Search in sources :

Example 1 with MethodRecorder

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

the class FrameSnapshotTest method teardown.

@After
public void teardown() {
    MethodRecorder actual = new MethodRecorder();
    frame.accept(actual.getVisitor());
    assertEquals(expected, actual);
}
Also used : MethodRecorder(org.jacoco.core.instr.MethodRecorder) After(org.junit.After)

Example 2 with MethodRecorder

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

the class FrameSnapshotTest method setup.

@Before
public void setup() {
    analyzer = new AnalyzerAdapter("Foo", 0, "doit", "()V", null);
    expected = new MethodRecorder();
    expectedVisitor = expected.getVisitor();
}
Also used : AnalyzerAdapter(org.objectweb.asm.commons.AnalyzerAdapter) MethodRecorder(org.jacoco.core.instr.MethodRecorder) Before(org.junit.Before)

Example 3 with MethodRecorder

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

the class MethodProbesAdapterTest method setup.

@Before
public void setup() {
    label = new Label();
    id = 1000;
    expected = new MethodRecorder();
    expectedVisitor = new TraceAdapter(expected);
    actual = new MethodRecorder();
    MethodProbesVisitor actualVisitor = new TraceAdapter(actual);
    MethodProbesAdapter probesAdapter = new MethodProbesAdapter(actualVisitor, this);
    final AnalyzerAdapter analyzer = new AnalyzerAdapter("Foo", 0, "doit", "()V", probesAdapter);
    probesAdapter.setAnalyzer(analyzer);
    adapter = analyzer;
    frame = new IFrame() {

        public void accept(MethodVisitor mv) {
        }
    };
}
Also used : AnalyzerAdapter(org.objectweb.asm.commons.AnalyzerAdapter) MethodRecorder(org.jacoco.core.instr.MethodRecorder) Label(org.objectweb.asm.Label) MethodVisitor(org.objectweb.asm.MethodVisitor) Before(org.junit.Before)

Example 4 with MethodRecorder

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

the class DuplicateFrameEliminatorTest method setup.

@Before
public void setup() {
    actual = new MethodRecorder();
    expected = new MethodRecorder();
    eliminator = new DuplicateFrameEliminator(actual.getVisitor());
}
Also used : MethodRecorder(org.jacoco.core.instr.MethodRecorder) Before(org.junit.Before)

Example 5 with MethodRecorder

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

the class OfflineInstrumentationAccessGeneratorTest method testRuntimeClassName.

@Test
public void testRuntimeClassName() throws Exception {
    generator = new OfflineInstrumentationAccessGenerator();
    MethodRecorder actual = new MethodRecorder();
    generator.generateDataAccessor(987654321, "foo/Bar", 17, actual.getVisitor());
    MethodRecorder expected = new MethodRecorder();
    expected.getVisitor().visitLdcInsn(Long.valueOf(987654321));
    expected.getVisitor().visitLdcInsn("foo/Bar");
    expected.getVisitor().visitIntInsn(Opcodes.BIPUSH, 17);
    String rtname = JaCoCo.RUNTIMEPACKAGE.replace('.', '/') + "/Offline";
    expected.getVisitor().visitMethodInsn(Opcodes.INVOKESTATIC, rtname, "getProbes", "(JLjava/lang/String;I)[Z", false);
    assertEquals(expected, actual);
}
Also used : MethodRecorder(org.jacoco.core.instr.MethodRecorder) Test(org.junit.Test)

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