// Path: src/test/com/olabini/jescov/matchers/LineCoverageMatcher.java
// public static LineCoverageMatcher hasLineCoverage(int expected) {
//     return new LineCoverageMatcher(expected);
// }
// 
// Path: src/test/com/olabini/jescov/matchers/LineCoverageMatcher.java
// public static LineCoverageMatcher haveBlankLineCoverage() {
//     return new LineCoverageMatcher(-1);
// }


import static org.hamcrest.MatcherAssert.assertThat;
import static com.olabini.jescov.matchers.LineCoverageMatcher.hasLineCoverage;
import static com.olabini.jescov.matchers.LineCoverageMatcher.haveBlankLineCoverage;
import cucumber.annotation.en.Then;
import java.util.List;
/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package com.olabini.jescov;




public class LineCoverageStepdefs {
    private CucumberData data;

    public LineCoverageStepdefs(CucumberData data) {
        this.data = data;
    }

    @Then("^the line coverage on line (\\d+) should be (\\d+)$")
    public void the_line_coverage_on_line_should_be_(int line, int expectedCoverage) {
        assertThat(data.getCoverageData(), hasLineCoverage(expectedCoverage).onLine(line));
    }

    @Then("^the line coverage on line (\\d+) should be blank$")
    public void the_line_coverage_on_line_should_be_blank(int line) {
        assertThat(data.getCoverageData(), haveBlankLineCoverage().onLine(line));
    }


    public static class LineExpectation {
        public String coverage;
        public String code;
    }

    @Then("^the line coverage is this:$")
    public void the_line_coverage_is_this(List<LineExpectation> expectations) {
        CoverageData cd = data.getCoverageData();
        int line = 1;
        for(LineExpectation le : expectations) {
            if(le.coverage.trim().length() == 0) {
                assertThat(cd, haveBlankLineCoverage().onLine(line++));
            } else {
// Path: src/test/com/olabini/jescov/matchers/LineCoverageMatcher.java
// public static LineCoverageMatcher hasLineCoverage(int expected) {
//     return new LineCoverageMatcher(expected);
// }
// 
// Path: src/test/com/olabini/jescov/matchers/LineCoverageMatcher.java
// public static LineCoverageMatcher haveBlankLineCoverage() {
//     return new LineCoverageMatcher(-1);
// }


// Path: src/test/com/olabini/jescov/LineCoverageStepdefs.java
import static org.hamcrest.MatcherAssert.assertThat;
import static com.olabini.jescov.matchers.LineCoverageMatcher.hasLineCoverage;
import static com.olabini.jescov.matchers.LineCoverageMatcher.haveBlankLineCoverage;
import cucumber.annotation.en.Then;
import java.util.List;

/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package com.olabini.jescov;




public class LineCoverageStepdefs {
    private CucumberData data;

    public LineCoverageStepdefs(CucumberData data) {
        this.data = data;
    }

    @Then("^the line coverage on line (\\d+) should be (\\d+)$")
    public void the_line_coverage_on_line_should_be_(int line, int expectedCoverage) {
        assertThat(data.getCoverageData(), hasLineCoverage(expectedCoverage).onLine(line));
    }

    @Then("^the line coverage on line (\\d+) should be blank$")
    public void the_line_coverage_on_line_should_be_blank(int line) {
        assertThat(data.getCoverageData(), haveBlankLineCoverage().onLine(line));
    }


    public static class LineExpectation {
        public String coverage;
        public String code;
    }

    @Then("^the line coverage is this:$")
    public void the_line_coverage_is_this(List<LineExpectation> expectations) {
        CoverageData cd = data.getCoverageData();
        int line = 1;
        for(LineExpectation le : expectations) {
            if(le.coverage.trim().length() == 0) {
                assertThat(cd, haveBlankLineCoverage().onLine(line++));
            } else {
                assertThat(cd, hasLineCoverage(Integer.parseInt(le.coverage)).onLine(line++));