use of com.uber.jenkins.phabricator.coverage.CodeCoverageMetrics in project phabricator-jenkins-plugin by uber.
the class CommentBuilderTest method testProcessWithDecreaseNotFailingTheBuild.
@Test
public void testProcessWithDecreaseNotFailingTheBuild() {
CodeCoverageMetrics fivePercentDrop = TestUtils.getCoverageResult(100.0f, 100.0f, 100.0f, 100.0f, 95.0f);
CommentBuilder commenter = createCommenter(Result.SUCCESS, fivePercentDrop, false, -10.0f);
boolean passCoverage = commenter.processParentCoverage(TestUtils.getDefaultCodeCoverageMetrics(), TestUtils.TEST_SHA, FAKE_BRANCH_NAME);
String comment = commenter.getComment();
assertTrue(passCoverage);
assertThat(comment, containsString("decreased (-5.000%)"));
assertFalse(comment.contains("Build failed because coverage is lower than minimum 100.0% and decreased more than allowed 10.0%."));
}
use of com.uber.jenkins.phabricator.coverage.CodeCoverageMetrics in project phabricator-jenkins-plugin by uber.
the class UberallsClientTest method testGetCoverageWorkingBackend.
@Test
public void testGetCoverageWorkingBackend() throws IOException {
JSONObject validJSON = TestUtils.getJSONFromFile(getClass(), "validCoverage");
server.register("/*", TestUtils.makeHttpHandler(HttpStatus.SC_OK, validJSON.toString()));
CodeCoverageMetrics metrics = client.getParentCoverage(TestUtils.TEST_SHA);
assertEquals(42.0f, metrics.getLineCoveragePercent(), 0.01f);
}
Aggregations