ParticipationGradeService.java

1
package edu.ucsb.cs156.happiercows.services;
2
3
import java.time.LocalDate;
4
import java.time.LocalDateTime;
5
import java.time.temporal.ChronoUnit;
6
import java.util.ArrayList;
7
import java.util.List;
8
import java.util.Map;
9
import java.util.Set;
10
import java.util.stream.Collectors;
11
12
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.stereotype.Service;
14
15
import edu.ucsb.cs156.happiercows.entities.Course;
16
import edu.ucsb.cs156.happiercows.entities.FarmerActivity;
17
import edu.ucsb.cs156.happiercows.entities.Student;
18
import edu.ucsb.cs156.happiercows.errors.EntityNotFoundException;
19
import edu.ucsb.cs156.happiercows.models.ParticipationGrade;
20
import edu.ucsb.cs156.happiercows.models.ParticipationGradeParams;
21
import edu.ucsb.cs156.happiercows.repositories.CourseRepository;
22
import edu.ucsb.cs156.happiercows.repositories.FarmerActivityRepository;
23
import edu.ucsb.cs156.happiercows.repositories.StudentRepository;
24
25
// See issue #292. "Interacted" (criteria 1 and 2) is any FarmerActivity row
26
// in the date range, regardless of type. "Owned a cow" (criterion 3) is
27
// deliberately NOT "was there ever a BUY/SELL row" - it's redefined as
28
// "checked in on the farm while owning at least one cow", i.e. a
29
// PLAY_PAGE_VIEW row (the only activity type whose numCows field is a
30
// snapshot of the farmer's total herd, rather than a transaction delta)
31
// with numCows >= 1. This sidesteps needing the Profit table (whose
32
// timestamps aren't in Pacific time - see issue #318) and naturally
33
// excludes cows that died before ever being checked on.
34
@Service
35
public class ParticipationGradeService {
36
37
    @Autowired
38
    CourseRepository courseRepository;
39
40
    @Autowired
41
    StudentRepository studentRepository;
42
43
    @Autowired
44
    FarmerActivityRepository farmerActivityRepository;
45
46
    public List<ParticipationGrade> computeGrades(ParticipationGradeParams params) {
47 1 1. computeGrades : removed call to edu/ucsb/cs156/happiercows/services/ParticipationGradeService::validate → KILLED
        validate(params);
48
49
        courseRepository.findById(params.getCourseId())
50 1 1. lambda$computeGrades$0 : replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGrades$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(Course.class, params.getCourseId()));
51
52
        List<Student> students = new ArrayList<>();
53 1 1. computeGrades : removed call to java/lang/Iterable::forEach → KILLED
        studentRepository.findByCourseId(params.getCourseId()).forEach(students::add);
54
55
        List<Long> studentIds = students.stream().map(Student::getId).collect(Collectors.toList());
56
57
        LocalDateTime startInclusive = params.getStartDate().atStartOfDay();
58
        LocalDateTime endExclusive = params.getEndDate().plusDays(1).atStartOfDay();
59
60 1 1. computeGrades : negated conditional → KILLED
        List<FarmerActivity> activities = studentIds.isEmpty()
61
                ? List.of()
62
                : farmerActivityRepository.findByStudentIdInAndTimestampGreaterThanEqualAndTimestampLessThan(
63
                        studentIds, startInclusive, endExclusive);
64
65
        Map<Long, List<FarmerActivity>> activitiesByStudentId = activities.stream()
66
                .collect(Collectors.groupingBy(FarmerActivity::getStudentId));
67
68 1 1. computeGrades : replaced return value with Collections.emptyList for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::computeGrades → KILLED
        return students.stream()
69 1 1. lambda$computeGrades$1 : replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGrades$1 → KILLED
                .map(student -> computeGradeForStudent(
70
                        student, activitiesByStudentId.getOrDefault(student.getId(), List.of()), params))
71
                .collect(Collectors.toList());
72
    }
73
74
    private void validate(ParticipationGradeParams params) {
75 1 1. validate : negated conditional → KILLED
        if (params.getEndDate().isBefore(params.getStartDate())) {
76
            throw new IllegalArgumentException("endDate must not be before startDate");
77
        }
78
79 2 1. validate : Replaced integer addition with subtraction → KILLED
2. validate : Replaced integer addition with subtraction → KILLED
        int totalWeight = params.getCriterion1Weight() + params.getCriterion2Weight() + params.getCriterion3Weight();
80 1 1. validate : negated conditional → KILLED
        if (totalWeight != 100) {
81
            throw new IllegalArgumentException(
82
                    "criterion weights must sum to 100, but sum to %d".formatted(totalWeight));
83
        }
84
85 2 1. validate : negated conditional → KILLED
2. validate : changed conditional boundary → KILLED
        if (params.getCriterion2Weight() > 0) {
86
            int daysInPeriod = daysInPeriod(params);
87 4 1. validate : changed conditional boundary → KILLED
2. validate : negated conditional → KILLED
3. validate : negated conditional → KILLED
4. validate : changed conditional boundary → KILLED
            if (params.getCriterion2MinDays() < 1 || params.getCriterion2MinDays() > daysInPeriod) {
88
                throw new IllegalArgumentException(
89
                        "criterion2MinDays must be between 1 and %d (the number of days in the period)"
90
                                .formatted(daysInPeriod));
91
            }
92
        }
93
    }
94
95
    private int daysInPeriod(ParticipationGradeParams params) {
96 2 1. daysInPeriod : Replaced long addition with subtraction → KILLED
2. daysInPeriod : replaced int return with 0 for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::daysInPeriod → KILLED
        return (int) (ChronoUnit.DAYS.between(params.getStartDate(), params.getEndDate()) + 1);
97
    }
98
99
    private ParticipationGrade computeGradeForStudent(
100
            Student student, List<FarmerActivity> activities, ParticipationGradeParams params) {
101
102 1 1. computeGradeForStudent : negated conditional → KILLED
        boolean interactedAtLeastOnce = !activities.isEmpty();
103
104
        Set<LocalDate> daysWithActivity = activities.stream()
105 1 1. lambda$computeGradeForStudent$0 : replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGradeForStudent$0 → KILLED
                .map(activity -> activity.getTimestamp().toLocalDate())
106
                .collect(Collectors.toSet());
107
        int daysInteracted = daysWithActivity.size();
108
109
        boolean ownedAndCheckedInOnACow = activities.stream()
110 2 1. lambda$computeGradeForStudent$1 : replaced boolean return with true for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGradeForStudent$1 → KILLED
2. lambda$computeGradeForStudent$1 : negated conditional → KILLED
                .anyMatch(activity -> activity.getActivityType() == FarmerActivity.ACTIVITY_TYPE_PLAY_PAGE_VIEW
111 2 1. lambda$computeGradeForStudent$1 : negated conditional → KILLED
2. lambda$computeGradeForStudent$1 : changed conditional boundary → KILLED
                        && activity.getNumCows() >= 1);
112
113 1 1. computeGradeForStudent : negated conditional → KILLED
        double criterion1Percent = params.getCriterion1Weight() == 0
114
                ? 0
115 1 1. computeGradeForStudent : negated conditional → KILLED
                : (interactedAtLeastOnce ? params.getCriterion1Weight() : 0);
116
117
        double criterion2Percent;
118 1 1. computeGradeForStudent : negated conditional → KILLED
        if (params.getCriterion2Weight() == 0) {
119
            criterion2Percent = 0;
120 1 1. computeGradeForStudent : negated conditional → KILLED
        } else if (params.isCriterion2PartialCredit()) {
121 1 1. computeGradeForStudent : Replaced double division with multiplication → KILLED
            double fraction = Math.min(1.0, (double) daysInteracted / params.getCriterion2MinDays());
122 1 1. computeGradeForStudent : Replaced double multiplication with division → KILLED
            criterion2Percent = fraction * params.getCriterion2Weight();
123
        } else {
124 2 1. computeGradeForStudent : negated conditional → KILLED
2. computeGradeForStudent : changed conditional boundary → KILLED
            criterion2Percent = daysInteracted >= params.getCriterion2MinDays() ? params.getCriterion2Weight() : 0;
125
        }
126
127 1 1. computeGradeForStudent : negated conditional → KILLED
        double criterion3Percent = params.getCriterion3Weight() == 0
128
                ? 0
129 1 1. computeGradeForStudent : negated conditional → KILLED
                : (ownedAndCheckedInOnACow ? params.getCriterion3Weight() : 0);
130
131
        double criterion1Points = pointsFor(criterion1Percent, params.getTotalPoints());
132
        double criterion2Points = pointsFor(criterion2Percent, params.getTotalPoints());
133
        double criterion3Points = pointsFor(criterion3Percent, params.getTotalPoints());
134
135 1 1. computeGradeForStudent : replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::computeGradeForStudent → KILLED
        return ParticipationGrade.builder()
136
                .studentId(student.getId())
137
                .perm(student.getPerm())
138
                .lastName(student.getLastName())
139
                .firstMiddleName(student.getFirstMiddleName())
140
                .interactedAtLeastOnce(interactedAtLeastOnce)
141
                .daysInteracted(daysInteracted)
142
                .ownedAndCheckedInOnACow(ownedAndCheckedInOnACow)
143
                .criterion1PointsEarned(criterion1Points)
144
                .criterion2PointsEarned(criterion2Points)
145 2 1. computeGradeForStudent : Replaced double addition with subtraction → KILLED
2. computeGradeForStudent : Replaced double addition with subtraction → KILLED
                .criterion3PointsEarned(criterion3Points)
146
                .totalPointsEarned(round(criterion1Points + criterion2Points + criterion3Points))
147
                .build();
148
    }
149
150
    private double pointsFor(double percent, double totalPoints) {
151 3 1. pointsFor : Replaced double multiplication with division → KILLED
2. pointsFor : Replaced double division with multiplication → KILLED
3. pointsFor : replaced double return with 0.0d for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::pointsFor → KILLED
        return round(percent / 100.0 * totalPoints);
152
    }
153
154
    private double round(double value) {
155 3 1. round : replaced double return with 0.0d for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::round → KILLED
2. round : Replaced double division with multiplication → KILLED
3. round : Replaced double multiplication with division → KILLED
        return Math.round(value * 100.0) / 100.0;
156
    }
157
}

Mutations

47

1.1
Location : computeGrades
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_weights_do_not_sum_to_100()]
removed call to edu/ucsb/cs156/happiercows/services/ParticipationGradeService::validate → KILLED

50

1.1
Location : lambda$computeGrades$0
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_course_not_found()]
replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGrades$0 → KILLED

53

1.1
Location : computeGrades
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:excludes_activity_outside_the_date_range()]
removed call to java/lang/Iterable::forEach → KILLED

60

1.1
Location : computeGrades
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:queries_activity_using_the_rosters_student_ids_and_the_date_range_as_a_half_open_interval()]
negated conditional → KILLED

68

1.1
Location : computeGrades
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:excludes_activity_outside_the_date_range()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::computeGrades → KILLED

69

1.1
Location : lambda$computeGrades$1
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:excludes_activity_outside_the_date_range()]
replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGrades$1 → KILLED

75

1.1
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_weights_do_not_sum_to_100()]
negated conditional → KILLED

79

1.1
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_weights_do_not_sum_to_100()]
Replaced integer addition with subtraction → KILLED

2.2
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_weights_do_not_sum_to_100()]
Replaced integer addition with subtraction → KILLED

80

1.1
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_weights_do_not_sum_to_100()]
negated conditional → KILLED

85

1.1
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_criterion2MinDays_is_less_than_1()]
negated conditional → KILLED

2.2
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:does_not_validate_criterion2MinDays_when_criterion2_is_disabled()]
changed conditional boundary → KILLED

87

1.1
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:accepts_criterion2MinDays_equal_to_days_in_period_the_upper_boundary()]
changed conditional boundary → KILLED

2.2
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_criterion2MinDays_is_less_than_1()]
negated conditional → KILLED

3.3
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_criterion2MinDays_exceeds_days_in_period()]
negated conditional → KILLED

4.4
Location : validate
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:accepts_criterion2MinDays_of_exactly_1_the_lower_boundary()]
changed conditional boundary → KILLED

96

1.1
Location : daysInPeriod
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_criterion2MinDays_is_less_than_1()]
Replaced long addition with subtraction → KILLED

2.2
Location : daysInPeriod
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:throws_when_criterion2MinDays_is_less_than_1()]
replaced int return with 0 for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::daysInPeriod → KILLED

102

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:excludes_activity_outside_the_date_range()]
negated conditional → KILLED

105

1.1
Location : lambda$computeGradeForStudent$0
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion2_allOrNothing_gives_full_credit_when_daysInteracted_meets_minDays()]
replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGradeForStudent$0 → KILLED

110

1.1
Location : lambda$computeGradeForStudent$1
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_false_for_buy_and_sell_activity_with_no_pageview()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::lambda$computeGradeForStudent$1 → KILLED

2.2
Location : lambda$computeGradeForStudent$1
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
negated conditional → KILLED

111

1.1
Location : lambda$computeGradeForStudent$1
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_exactly_one_cow_the_boundary()]
negated conditional → KILLED

2.2
Location : lambda$computeGradeForStudent$1
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_exactly_one_cow_the_boundary()]
changed conditional boundary → KILLED

113

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion1_gives_full_credit_for_any_activity_in_range()]
negated conditional → KILLED

115

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:gives_zero_credit_to_a_student_with_no_activity()]
negated conditional → KILLED

118

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion2_allOrNothing_gives_full_credit_when_daysInteracted_meets_minDays()]
negated conditional → KILLED

120

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:combines_all_three_criteria_into_a_weighted_total()]
negated conditional → KILLED

121

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:combines_all_three_criteria_into_a_weighted_total()]
Replaced double division with multiplication → KILLED

122

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion2_partialCredit_is_capped_at_full_weight_when_daysInteracted_exceeds_minDays()]
Replaced double multiplication with division → KILLED

124

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:gives_zero_credit_to_a_student_with_no_activity()]
negated conditional → KILLED

2.2
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion2_allOrNothing_gives_full_credit_when_daysInteracted_meets_minDays()]
changed conditional boundary → KILLED

127

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
negated conditional → KILLED

129

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
negated conditional → KILLED

135

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:excludes_activity_outside_the_date_range()]
replaced return value with null for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::computeGradeForStudent → KILLED

145

1.1
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion2_allOrNothing_gives_full_credit_when_daysInteracted_meets_minDays()]
Replaced double addition with subtraction → KILLED

2.2
Location : computeGradeForStudent
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
Replaced double addition with subtraction → KILLED

151

1.1
Location : pointsFor
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
Replaced double multiplication with division → KILLED

2.2
Location : pointsFor
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
Replaced double division with multiplication → KILLED

3.3
Location : pointsFor
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
replaced double return with 0.0d for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::pointsFor → KILLED

155

1.1
Location : round
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
replaced double return with 0.0d for edu/ucsb/cs156/happiercows/services/ParticipationGradeService::round → KILLED

2.2
Location : round
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
Replaced double division with multiplication → KILLED

3.3
Location : round
Killed by : edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.services.ParticipationGradeServiceTests]/[method:criterion3_is_true_for_a_pageview_with_at_least_one_cow()]
Replaced double multiplication with division → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1