Package org.jacoco.core.data

Examples of org.jacoco.core.data.IMethodStructureVisitor


    // TODO: Use filter hook
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
      return null;
    }

    final IMethodStructureVisitor structure = structureVisitor
        .visitMethodStructure(methodCount++, name, desc, signature);
    return new BlockMethodAdapter(new MethodAnalyzer(structure), access,
        name, desc, signature, exceptions);
  }
View Full Code Here


  @Test
  public void testCreateClassNotCovered() {
    final IClassStructureVisitor classStructure = coverageBuilder
        .visitClassStructure(123L, "org/jacoco/examples/Sample");
    final IMethodStructureVisitor methodStructure = classStructure
        .visitMethodStructure(0, "doit", "()V", null);
    methodStructure.block(0, 5, new int[] { 6, 7, 8 });
    methodStructure.visitEnd();
    classStructure.visitEnd();

    final Collection<ClassCoverage> classes = coverageBuilder.getClasses();
    assertEquals(1, classes.size(), 1.0);
    ClassCoverage c = classes.iterator().next();
View Full Code Here

  public void testCreateClassCovered() {
    executionData.visitClassExecution(123L, "org/jacoco/examples/Sample",
        new boolean[][] { new boolean[] { true } });
    final IClassStructureVisitor classStructure = coverageBuilder
        .visitClassStructure(123L, "org/jacoco/examples/Sample");
    final IMethodStructureVisitor methodStructure = classStructure
        .visitMethodStructure(0, "doit", "()V", null);
    methodStructure.block(0, 5, new int[] { 6, 7, 8 });
    methodStructure.visitEnd();
    classStructure.visitEnd();

    final Collection<ClassCoverage> classes = coverageBuilder.getClasses();
    assertEquals(1, classes.size(), 1.0);
    ClassCoverage c = classes.iterator().next();
View Full Code Here

  private IMethodStructureVisitor createMethodVisitor(final String name,
      final String desc, final String signature,
      final Collection<MethodCoverage> container, final boolean[] covered) {
    final MethodCoverage method = new MethodCoverage(name, desc, signature);
    return new IMethodStructureVisitor() {
      public void block(final int id, final int instructions,
          final int[] lineNumbers) {
        final boolean c = covered == null ? false : covered[id];
        method.addBlock(instructions, lineNumbers, c);
      }
View Full Code Here

  public void testCreateClassMissed() {
    final IClassStructureVisitor classStructure = coverageBuilder
        .visitClassStructure(123L);
    classStructure.visit("org/jacoco/examples/Sample", null,
        "java/lang/Object", new String[0]);
    final IMethodStructureVisitor methodStructure = classStructure
        .visitMethodStructure("doit", "()V", null);
    methodStructure.block(0, 5, new int[] { 6, 7, 8 });
    methodStructure.visitEnd();
    classStructure.visitEnd();

    final Collection<ClassCoverage> classes = coverageBuilder.getClasses();
    assertEquals(1, classes.size(), 1.0);
    ClassCoverage c = classes.iterator().next();
View Full Code Here

    // TODO: Use filter hook
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
      return null;
    }

    final IMethodStructureVisitor structure = structureVisitor
        .visitMethodStructure(name, desc, signature);
    return new MethodAnalyzer(structure);
  }
View Full Code Here

  private IMethodStructureVisitor createMethodVisitor(final String name,
      final String desc, final String signature,
      final Collection<MethodCoverage> container, final boolean[] covered) {
    final MethodCoverage method = new MethodCoverage(name, desc, signature);
    return new IMethodStructureVisitor() {
      public void block(final int id, final int instructions,
          final int[] lineNumbers) {
        final boolean c = covered == null ? false : covered[id];
        method.addBlock(instructions, lineNumbers, c);
      }
View Full Code Here

  public void testCreateClassMissed() {
    final IClassStructureVisitor classStructure = coverageBuilder
        .visitClassStructure(123L);
    classStructure.visit("org/jacoco/examples/Sample", null,
        "java/lang/Object", new String[0]);
    final IMethodStructureVisitor methodStructure = classStructure
        .visitMethodStructure("doit", "()V", null);
    methodStructure.block(0, 5, new int[] { 6, 7, 8 });
    methodStructure.visitEnd();
    classStructure.visitEnd();

    final Collection<ClassCoverage> classes = coverageBuilder.getClasses();
    assertEquals(1, classes.size(), 1.0);
    ClassCoverage c = classes.iterator().next();
View Full Code Here

        new boolean[] { true }));
    final IClassStructureVisitor classStructure = coverageBuilder
        .visitClassStructure(123L);
    classStructure.visit("org/jacoco/examples/Sample", null,
        "java/lang/Object", new String[0]);
    final IMethodStructureVisitor methodStructure = classStructure
        .visitMethodStructure("doit", "()V", null);
    methodStructure.block(0, 5, new int[] { 6, 7, 8 });
    methodStructure.visitEnd();
    classStructure.visitEnd();

    final Collection<ClassCoverage> classes = coverageBuilder.getClasses();
    assertEquals(1, classes.size(), 1.0);
    ClassCoverage c = classes.iterator().next();
View Full Code Here

  public void testIgnoreMethodsWithoutCode() {
    final IClassStructureVisitor classStructure = coverageBuilder
        .visitClassStructure(123L);
    classStructure.visit("org/jacoco/examples/Sample", null,
        "java/lang/Object", new String[0]);
    final IMethodStructureVisitor methodStructure1 = classStructure
        .visitMethodStructure("a", "()V", null);
    methodStructure1.block(0, 5, new int[0]);
    methodStructure1.visitEnd();
    final IMethodStructureVisitor methodStructure2 = classStructure
        .visitMethodStructure("b", "()V", null);
    methodStructure2.visitEnd();
    classStructure.visitEnd();

    final ClassCoverage classCoverage = coverageBuilder.getClasses()
        .iterator().next();
    assertEquals(Collections.singleton("a"), getNames(classCoverage
View Full Code Here

TOP

Related Classes of org.jacoco.core.data.IMethodStructureVisitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.