Package org.sonar.api.batch.sensor.test.internal

Examples of org.sonar.api.batch.sensor.test.internal.DefaultTestCaseCoverage


    this.inputPathCache = inputPathCache;
  }

  @Override
  public void put(Value value, Object object, CoderContext context) {
    DefaultTestCaseCoverage t = (DefaultTestCaseCoverage) object;
    value.putUTF(((DefaultInputFile) t.testFile()).moduleKey());
    value.putUTF(((DefaultInputFile) t.testFile()).relativePath());
    value.putUTF(t.testName());
    value.putUTF(((DefaultInputFile) t.coveredFile()).moduleKey());
    value.putUTF(((DefaultInputFile) t.coveredFile()).relativePath());
    value.put(t.coveredLines().size());
    for (Integer line : t.coveredLines()) {
      value.put(line.intValue());
    }
  }
View Full Code Here


    int size = value.getInt();
    List<Integer> lines = new ArrayList<Integer>(size);
    for (int i = 0; i < size; i++) {
      lines.add(value.getInt());
    }
    return new DefaultTestCaseCoverage()
      .testFile(testFile)
      .testName(name)
      .cover(mainFile)
      .onLines(lines);
  }
View Full Code Here

    final SensorStorage sensorStorage = mock(SensorStorage.class);

    when(context.newTestCaseCoverage()).thenAnswer(new Answer<TestCaseCoverage>() {
      @Override
      public TestCaseCoverage answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultTestCaseCoverage(sensorStorage);
      }
    });

    sensor.execute(context);

    verify(sensorStorage).store(new DefaultTestCaseCoverage()
      .testFile(testFile)
      .testName("test1")
      .cover(inputFile)
      .onLines(Arrays.asList(1, 2, 3, 4)));
    verify(sensorStorage).store(new DefaultTestCaseCoverage()
      .testFile(testFile)
      .testName("test2")
      .cover(inputFile)
      .onLines(Arrays.asList(5, 6, 7)));
  }
View Full Code Here

    return new DefaultTestCaseExecution(this);
  }

  @Override
  public TestCaseCoverage newTestCaseCoverage() {
    return new DefaultTestCaseCoverage(this);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.sensor.test.internal.DefaultTestCaseCoverage

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.