Package org.sonar.core.component

Examples of org.sonar.core.component.ScanGraph


    assertThat(cover.lines()).containsExactly(10, 11, 12);
  }

  @Test
  public void should_cover_multiple_testables() {
    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = graph.createAdjacentVertex(file1, DefaultTestable.class, "testable");
    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = graph.createAdjacentVertex(file2, DefaultTestable.class, "testable");
    DefaultTestCase testCase = graph.createVertex(DefaultTestCase.class);

    testCase.setCoverageBlock(testable1, Arrays.asList(10, 11, 12));
    testCase.setCoverageBlock(testable2, Arrays.asList(12, 13, 14));

    assertThat(testCase.doesCover()).isTrue();
View Full Code Here


  @Test
  public void should_return_cover_of_testable() {
    BeanGraph beanGraph = BeanGraph.createInMemory();

    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = beanGraph.createAdjacentVertex(file1, DefaultTestable.class, "testable");

    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = beanGraph.createAdjacentVertex(file2, DefaultTestable.class, "testable");

    DefaultTestCase testCase = beanGraph.createVertex(DefaultTestCase.class);
    testCase.setCoverageBlock(testable1, Arrays.asList(10, 11, 12));
View Full Code Here

  @Test
  public void should_fail_if_coverage_block_already_exits() {
    thrown.expect(CoverageAlreadyExistsException.class);

    ScanGraph graph = ScanGraph.create();

    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable = graph.createAdjacentVertex(file, DefaultTestable.class, "testable");

    DefaultTestCase testCase = graph.createVertex(DefaultTestCase.class);
    testCase.setCoverageBlock(testable, Arrays.asList(10, 11, 12));

    // error
    testCase.setCoverageBlock(testable, Arrays.asList(20));
  }
View Full Code Here

import static org.fest.assertions.Assertions.assertThat;

public class TestableBuilderTest {
  @Test
  public void test_path() {
    ScanGraph graph = ScanGraph.create();
    TestablePerspectiveLoader loader = new TestablePerspectiveLoader();
    TestableBuilder builder = new TestableBuilder(graph, loader);

    assertThat(builder.path().getElements()).isNotEmpty();
  }
View Full Code Here

    assertThat(builder.path().getElements()).isNotEmpty();
  }

  @Test
  public void should_not_load_missing_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestablePerspectiveLoader loader = new TestablePerspectiveLoader();
    TestableBuilder builder = new TestableBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    assertThat(builder.getPerspectiveLoader().load(file)).isNull();
  }
View Full Code Here

    assertThat(builder.getPerspectiveLoader().load(file)).isNull();
  }

  @Test
  public void should_create_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestablePerspectiveLoader loader = new TestablePerspectiveLoader();
    TestableBuilder builder = new TestableBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    MutableTestable testable = builder.create(file);
    assertThat(testable).isNotNull();
    assertThat(testable.component()).isSameAs(file);
    assertThat(builder.getPerspectiveLoader().load(file)).isSameAs(testable);
View Full Code Here

  @Test
  public void return_cover_of_testCase(){
    BeanGraph beanGraph = BeanGraph.createInMemory();

    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = beanGraph.createAdjacentVertex(file1, DefaultTestable.class, "testable");

    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = beanGraph.createAdjacentVertex(file2, DefaultTestable.class, "testable");

    DefaultTestPlan plan = beanGraph.createVertex(DefaultTestPlan.class);
    plan.addTestCase("T1");
View Full Code Here

public class TestPlanBuilderTest {
  @Test
  public void test_path() {

    ScanGraph graph = ScanGraph.create();
    TestPlanPerspectiveLoader loader = new TestPlanPerspectiveLoader();
    TestPlanBuilder builder = new TestPlanBuilder(graph, loader);

    assertThat(builder.path().getElements()).isNotEmpty();
  }
View Full Code Here

    assertThat(builder.path().getElements()).isNotEmpty();
  }

  @Test
  public void should_not_load_missing_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestPlanPerspectiveLoader loader = new TestPlanPerspectiveLoader();
    TestPlanBuilder builder = new TestPlanBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    assertThat(builder.getPerspectiveLoader().load(file)).isNull();
  }
View Full Code Here

    assertThat(builder.getPerspectiveLoader().load(file)).isNull();
  }

  @Test
  public void should_create_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestPlanPerspectiveLoader loader = new TestPlanPerspectiveLoader();
    TestPlanBuilder builder = new TestPlanBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    MutableTestPlan plan = builder.create(file);
    assertThat(plan).isNotNull();
    assertThat(plan.component()).isSameAs(file);
    assertThat(builder.getPerspectiveLoader().load(file)).isSameAs(plan);
View Full Code Here

TOP

Related Classes of org.sonar.core.component.ScanGraph

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.