diff --git a/src/main/java/com/github/tkutche1/jgrade/DeductiveGraderStrategy.java b/src/main/java/com/github/tkutche1/jgrade/DeductiveGraderStrategy.java index fbedbef..641a864 100644 --- a/src/main/java/com/github/tkutche1/jgrade/DeductiveGraderStrategy.java +++ b/src/main/java/com/github/tkutche1/jgrade/DeductiveGraderStrategy.java @@ -48,6 +48,8 @@ public void grade(List l) { for (GradedTestResult r : l) { if (!r.passed()) { this.deductedPoints += this.deduct(r); + } else { + r.setScore(0); } r.setPoints(0); } diff --git a/src/test/java/com/github/tkutche1/jgrade/DeductiveGraderStrategyTest.java b/src/test/java/com/github/tkutche1/jgrade/DeductiveGraderStrategyTest.java index 85eb8f5..81cacde 100644 --- a/src/test/java/com/github/tkutche1/jgrade/DeductiveGraderStrategyTest.java +++ b/src/test/java/com/github/tkutche1/jgrade/DeductiveGraderStrategyTest.java @@ -28,13 +28,20 @@ private static GradedTestResult failedGradedTestResult(double points) { return r; } + private static GradedTestResult successfulGradedTestResult(double points) { + GradedTestResult r = new GradedTestResult("", "", points, HIDDEN); + r.setPassed(true); + r.setScore(points); + return r; + } + @Test public void noDeductions() { List l = new ArrayList<>(); - l.add(new GradedTestResult("", "", 2.0, HIDDEN)); - l.add(new GradedTestResult("", "", 2.0, HIDDEN)); - l.add(new GradedTestResult("", "", 2.0, HIDDEN)); - l.add(new GradedTestResult("", "", 2.0, HIDDEN)); + l.add(successfulGradedTestResult(2.0)); + l.add(successfulGradedTestResult(2.0)); + l.add(successfulGradedTestResult(2.0)); + l.add(successfulGradedTestResult(2.0)); this.unit.grade(l); diff --git a/src/test/java/com/github/tkutche1/jgrade/gradescope/GradescopeJsonObserverTest.java b/src/test/java/com/github/tkutche1/jgrade/gradescope/GradescopeJsonObserverTest.java index 1b3d776..6eb1019 100644 --- a/src/test/java/com/github/tkutche1/jgrade/gradescope/GradescopeJsonObserverTest.java +++ b/src/test/java/com/github/tkutche1/jgrade/gradescope/GradescopeJsonObserverTest.java @@ -7,6 +7,8 @@ import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + public class GradescopeJsonObserverTest { private GradescopeJsonObserver unit;