Package org.jacoco.core.internal.analysis

Examples of org.jacoco.core.internal.analysis.MethodCoverageImpl


    assertEquals(3, m.getLineCounter().getCoveredCount());
  }

  @Test
  public void testIgnoreClassesWithoutCode() {
    final MethodCoverageImpl method = new MethodCoverageImpl("doit", "()V",
        null);
    addClass(123L, "Sample", null, method);

    final Collection<IClassCoverage> classes = coverageBuilder.getClasses();
    assertTrue(classes.isEmpty());
View Full Code Here


    assertTrue(classes.isEmpty());
  }

  @Test(expected = IllegalStateException.class)
  public void testDuplicateClassName() {
    MethodCoverageImpl method = new MethodCoverageImpl("doit", "()V", null);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 3);
    addClass(123L, "Sample", null, method);

    method = new MethodCoverageImpl("doit", "()V", null);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 3);
    addClass(345L, "Sample", null, method);
  }
View Full Code Here

  private MethodCoverageImpl node;

  @Before
  public void setup() {
    node = new MethodCoverageImpl("test", "()V", null);
  }
View Full Code Here

  @Override
  public void setup() throws Exception {
    super.setup();
    node = new ClassCoverageImpl("org/jacoco/example/Foo", 123, null,
        "java/lang/Object", null);
    node.addMethod(new MethodCoverageImpl("a", "()V", null));
    node.addMethod(new MethodCoverageImpl("b", "()V", null));
    node.addMethod(new MethodCoverageImpl("c", "()V", null));
  }
View Full Code Here

        getNames(p2.getClasses()));
  }

  @Test
  public void testGetNoMatchClasses() {
    MethodCoverageImpl m = new MethodCoverageImpl("doit", "()V", null);
    m.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 1);
    addClass(1, true, "Sample1", null, m);

    m = new MethodCoverageImpl("doit", "()V", null);
    m.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 2);
    addClass(2, true, "Sample2", null, m);

    m = new MethodCoverageImpl("doit", "()V", null);
    m.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 3);
    addClass(3, false, "Sample3", null, m);

    final Set<String> actual = getNames(coverageBuilder.getNoMatchClasses());
    final Set<String> expected = new HashSet<String>(Arrays.asList(
        "Sample1", "Sample2"));
View Full Code Here

    rules.add(rule);
    return rule;
  }

  private IBundleCoverage createBundle() {
    final MethodCoverageImpl m = new MethodCoverageImpl("fooMethod", "()V",
        null);
    m.increment(CounterImpl.getInstance(5, 5), CounterImpl.COUNTER_0_0, 1);
    m.incrementMethodCounter();

    final ClassCoverageImpl c = new ClassCoverageImpl(
        "org/jacoco/example/FooClass", 1001, false, null,
        "java/lang/Object", new String[0]);
    c.setSourceFileName("FooClass.java");
View Full Code Here

    coverageBuilder = new CoverageBuilder();
  }

  @Test
  public void testCreateClassMissed() {
    final MethodCoverageImpl method = new MethodCoverageImpl("doit", "()V",
        null);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 6);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 7);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 8);
    method.incrementMethodCounter();
    addClass(123L, false, "Sample", null, method);

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

    assertEquals(0, m.getLineCounter().getCoveredCount());
  }

  @Test
  public void testCreateClassCovered() {
    final MethodCoverageImpl method = new MethodCoverageImpl("doit", "()V",
        null);
    method.increment(CounterImpl.COUNTER_0_1, CounterImpl.COUNTER_0_0, 6);
    method.increment(CounterImpl.COUNTER_0_1, CounterImpl.COUNTER_0_0, 7);
    method.increment(CounterImpl.COUNTER_0_1, CounterImpl.COUNTER_0_0, 8);
    method.incrementMethodCounter();
    addClass(123L, false, "Sample", null, method);

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

    assertEquals(3, m.getLineCounter().getCoveredCount());
  }

  @Test
  public void testIgnoreClassesWithoutCode() {
    final MethodCoverageImpl method = new MethodCoverageImpl("doit", "()V",
        null);
    addClass(123L, false, "Sample", null, method);

    final Collection<IClassCoverage> classes = coverageBuilder.getClasses();
    assertTrue(classes.isEmpty());
View Full Code Here

    assertTrue(classes.isEmpty());
  }

  @Test(expected = IllegalStateException.class)
  public void testDuplicateClassNameDifferent() {
    MethodCoverageImpl method = new MethodCoverageImpl("doit", "()V", null);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 3);
    addClass(123L, false, "Sample", null, method);

    // Add class with different id must fail:
    method = new MethodCoverageImpl("doit", "()V", null);
    method.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 3);
    addClass(345L, false, "Sample", null, method);
  }
View Full Code Here

TOP

Related Classes of org.jacoco.core.internal.analysis.MethodCoverageImpl

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.