UpdateCowHealthJob.java

1
package edu.ucsb.cs156.happiercows.jobs;
2
3
import edu.ucsb.cs156.happiercows.entities.Game;
4
import edu.ucsb.cs156.happiercows.entities.GamePlus;
5
import edu.ucsb.cs156.happiercows.entities.User;
6
import edu.ucsb.cs156.happiercows.entities.Farmer;
7
import edu.ucsb.cs156.happiercows.entities.Herd;
8
import edu.ucsb.cs156.happiercows.repositories.GameRepository;
9
import edu.ucsb.cs156.happiercows.repositories.FarmerRepository;
10
import edu.ucsb.cs156.happiercows.repositories.HerdRepository;
11
import edu.ucsb.cs156.happiercows.repositories.UserRepository;
12
import edu.ucsb.cs156.jobs.services.JobContext;
13
import edu.ucsb.cs156.jobs.services.JobContextConsumer;
14
import edu.ucsb.cs156.happiercows.services.GamePlusBuilderService;
15
import edu.ucsb.cs156.happiercows.strategies.CowHealthUpdateStrategy;
16
import java.util.function.DoubleSupplier;
17
18
import lombok.AllArgsConstructor;
19
import lombok.Getter;
20
21
@AllArgsConstructor
22
public class UpdateCowHealthJob implements JobContextConsumer {
23
24
    @Getter
25
    private GameRepository gameRepository;
26
    @Getter
27
    private FarmerRepository farmerRepository;
28
    @Getter
29
    private UserRepository userRepository;
30
    @Getter
31
    private GamePlusBuilderService gamePlusBuilderService;
32
    @Getter
33
    private HerdRepository herdRepository;
34
    // Source of random numbers in [0, 1) for cow deaths; replaced in tests.
35
    @Getter
36
    private DoubleSupplier random;
37
38
    @Override
39
    public void accept(JobContext ctx) throws Exception {
40 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
        ctx.log("Updating cow health...");
41
42
43
        Iterable<Game> allGame = gameRepository.findAll();
44
        Iterable<GamePlus> allGamePlus = gamePlusBuilderService.convertToGamePlus(allGame);
45
46
        for (GamePlus gamePlus : allGamePlus) {
47
48
49
            Game game = gamePlus.getGame();
50
51 1 1. accept : negated conditional → KILLED
            if (!GameGate.shouldProcess(game, gameRepository, ctx)) {
52
                continue;
53
            }
54
55 1 1. accept : removed call to edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::runUpdateJobInGame → KILLED
            runUpdateJobInGame(game, gamePlus, gamePlusBuilderService, gameRepository, farmerRepository, herdRepository, random, ctx);
56
57
        }
58
59 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
        ctx.log("Cow health has been updated!");
60
    }
61
62
    // Cows in a herd below this health may die (see docs/gamePlay.md).
63
    public static final double DEATH_HEALTH_THRESHOLD = 30.0;
64
    // Chance that each cow in a herd below the threshold dies during one update.
65
    public static final double DEATH_CHANCE_PER_COW = 0.01;
66
67
    // exposed for testing
68
    public static double calculateNewCowHealthUsingStrategy(
69
            CowHealthUpdateStrategy strategy,
70
            GamePlus gamePlus,
71
            double cowHealth,
72
            int totalCows
73
    ) {
74
        var health = strategy.calculateNewCowHealth(gamePlus, cowHealth, totalCows);
75 1 1. calculateNewCowHealthUsingStrategy : replaced double return with 0.0d for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::calculateNewCowHealthUsingStrategy → KILLED
        return Math.max(0, Math.min(health, 100));
76
    }
77
78
    /**
79
     * Removes the cows that die in this herd during one update, and returns how
80
     * many died. A herd at 0 health loses all of its cows. A herd below
81
     * DEATH_HEALTH_THRESHOLD loses each cow with chance DEATH_CHANCE_PER_COW,
82
     * using random (a source of numbers in [0, 1)) so tests can control it.
83
     */
84
    public static int calculateCowDeaths(Herd herd, DoubleSupplier random) {
85
        int deaths = 0;
86 1 1. calculateCowDeaths : negated conditional → KILLED
        if (herd.getHealth() == 0.0) {
87
            deaths = herd.getNumCows();
88 2 1. calculateCowDeaths : changed conditional boundary → KILLED
2. calculateCowDeaths : negated conditional → KILLED
        } else if (herd.getHealth() < DEATH_HEALTH_THRESHOLD) {
89 2 1. calculateCowDeaths : negated conditional → KILLED
2. calculateCowDeaths : changed conditional boundary → KILLED
            for (int i = 0; i < herd.getNumCows(); i++) {
90 2 1. calculateCowDeaths : negated conditional → KILLED
2. calculateCowDeaths : changed conditional boundary → KILLED
                if (random.getAsDouble() < DEATH_CHANCE_PER_COW) {
91 1 1. calculateCowDeaths : Changed increment from 1 to -1 → KILLED
                    deaths++;
92
                }
93
            }
94
        }
95 2 1. calculateCowDeaths : removed call to edu/ucsb/cs156/happiercows/entities/Herd::setNumCows → KILLED
2. calculateCowDeaths : Replaced integer subtraction with addition → KILLED
        herd.setNumCows(herd.getNumCows() - deaths);
96 1 1. calculateCowDeaths : replaced int return with 0 for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::calculateCowDeaths → KILLED
        return deaths;
97
    }
98
99
    public static void runUpdateJobInGame(Game game, GamePlus gamePlus, GamePlusBuilderService gamePlusBuilderService,
100
            GameRepository gameRepository, FarmerRepository farmerRepository, HerdRepository herdRepository,
101
            DoubleSupplier random, JobContext ctx) {
102 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
        ctx.log("Game " + game.getName() + ", degradationRate: " + game.getDegradationRate() + ", effectiveCapacity: " + gamePlus.getEffectiveCapacity());
103
104 1 1. lambda$runUpdateJobInGame$0 : replaced return value with null for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::lambda$runUpdateJobInGame$0 → KILLED
        int numUsers = gameRepository.getNumUsers(game.getId()).orElseThrow(() -> new RuntimeException("Error calling getNumUsers(" + game.getId() + ")"));
105
106 1 1. runUpdateJobInGame : negated conditional → KILLED
        if (numUsers == 0) {
107 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
            ctx.log("No users in this game, skipping");
108
            return;
109
        }
110
111
        int carryingCapacity = gamePlus.getEffectiveCapacity();
112
        Iterable<Farmer> allFarmer = farmerRepository.findByGameId(game.getId());
113
114 1 1. lambda$runUpdateJobInGame$1 : replaced return value with null for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::lambda$runUpdateJobInGame$1 → KILLED
        Integer totalCows = gameRepository.getNumCows(game.getId()).orElseThrow(() -> new RuntimeException("Error calling getNumCows(" + game.getId() + ")"));
115
116 2 1. runUpdateJobInGame : changed conditional boundary → KILLED
2. runUpdateJobInGame : negated conditional → KILLED
        var isAboveCapacity = totalCows > carryingCapacity;
117 1 1. runUpdateJobInGame : negated conditional → KILLED
        var cowHealthUpdateStrategy = isAboveCapacity ? game.getAboveCapacityHealthUpdateStrategy() : game.getBelowCapacityHealthUpdateStrategy();
118
        GamePlus currentGamePlus = gamePlusBuilderService.toGamePlus(game);
119
120
        for (Farmer farmer : allFarmer) {
121
            User user = farmer.getUser();
122 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
            ctx.log("User: " + user.getFullName() + ", numCows: " + farmer.getNumOfCows() + ", cowHealth: " + farmer.getCowHealth());
123
124
            int survivingCows = 0;
125
            double totalHealth = 0;
126
            for (Herd herd : herdRepository.findByGameIdAndUserId(game.getId(), farmer.getUserId())) {
127
                double oldHealth = herd.getHealth();
128 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/happiercows/entities/Herd::setHealth → KILLED
                herd.setHealth(calculateNewCowHealthUsingStrategy(cowHealthUpdateStrategy, currentGamePlus, oldHealth, totalCows));
129
                int deaths = calculateCowDeaths(herd, random);
130 2 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowDeaths → KILLED
2. runUpdateJobInGame : Replaced integer addition with subtraction → KILLED
                farmer.setCowDeaths(farmer.getCowDeaths() + deaths);
131 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
                ctx.log(" Herd #" + herd.getHerdNumber() + ": old health: " + oldHealth + ", new health: " + herd.getHealth()
132
                        + ", cows died: " + deaths + ", cows left: " + herd.getNumCows());
133
134 1 1. runUpdateJobInGame : negated conditional → KILLED
                if (herd.getNumCows() == 0) {
135 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/happiercows/repositories/HerdRepository::delete → KILLED
                    herdRepository.delete(herd);
136
                } else {
137
                    herdRepository.save(herd);
138 1 1. runUpdateJobInGame : Replaced integer addition with subtraction → KILLED
                    survivingCows += herd.getNumCows();
139 2 1. runUpdateJobInGame : Replaced double multiplication with division → KILLED
2. runUpdateJobInGame : Replaced double addition with subtraction → KILLED
                    totalHealth += herd.getHealth() * herd.getNumCows();
140
                }
141
            }
142
143
            // Keep the farmer's totals in step with their herds: total cows and
144
            // average health weighted by cow count (100 when they have no cows,
145
            // the health a newly bought herd starts at).
146 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setNumOfCows → KILLED
            farmer.setNumOfCows(survivingCows);
147 4 1. runUpdateJobInGame : Replaced double division with multiplication → KILLED
2. runUpdateJobInGame : changed conditional boundary → KILLED
3. runUpdateJobInGame : negated conditional → KILLED
4. runUpdateJobInGame : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowHealth → KILLED
            farmer.setCowHealth(survivingCows > 0 ? totalHealth / survivingCows : 100.0);
148 1 1. runUpdateJobInGame : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
            ctx.log(" new numCows: " + farmer.getNumOfCows() + ", new cowHealth: " + farmer.getCowHealth());
149
            farmerRepository.save(farmer);
150
        }
151
    }
152
}

Mutations

40

1.1
Location : accept
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_log_output_with_no_game()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

51

1.1
Location : accept
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_skips_game_when_game_not_in_progress()]
negated conditional → KILLED

55

1.1
Location : accept
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_skipping_job_when_game_has_zero_users()]
removed call to edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::runUpdateJobInGame → KILLED

59

1.1
Location : accept
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_log_output_with_no_game()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

75

1.1
Location : calculateNewCowHealthUsingStrategy
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_strategy_is_given_the_herds_health()]
replaced double return with 0.0d for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::calculateNewCowHealthUsingStrategy → KILLED

86

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_kills_every_cow_at_zero_health()]
negated conditional → KILLED

88

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_does_nothing_at_30_health_or_more()]
changed conditional boundary → KILLED

2.2
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_does_nothing_at_30_health_or_more()]
negated conditional → KILLED

89

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_gives_each_cow_a_one_percent_chance_below_30_health()]
negated conditional → KILLED

2.2
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_gives_each_cow_a_one_percent_chance_below_30_health()]
changed conditional boundary → KILLED

90

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_gives_each_cow_a_one_percent_chance_below_30_health()]
negated conditional → KILLED

2.2
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_gives_each_cow_a_one_percent_chance_below_30_health()]
changed conditional boundary → KILLED

91

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_gives_each_cow_a_one_percent_chance_below_30_health()]
Changed increment from 1 to -1 → KILLED

95

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_kills_every_cow_at_zero_health()]
removed call to edu/ucsb/cs156/happiercows/entities/Herd::setNumCows → KILLED

2.2
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_kills_every_cow_at_zero_health()]
Replaced integer subtraction with addition → KILLED

96

1.1
Location : calculateCowDeaths
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:calculateCowDeaths_kills_every_cow_at_zero_health()]
replaced int return with 0 for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::calculateCowDeaths → KILLED

102

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_skipping_job_when_game_has_zero_users()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

104

1.1
Location : lambda$runUpdateJobInGame$0
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_throws_exception_when_get_num_users_fails()]
replaced return value with null for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::lambda$runUpdateJobInGame$0 → KILLED

106

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_skipping_job_when_game_has_zero_users()]
negated conditional → KILLED

107

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_skipping_job_when_game_has_zero_users()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

114

1.1
Location : lambda$runUpdateJobInGame$1
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_throws_exception_when_get_num_cows_fails()]
replaced return value with null for edu/ucsb/cs156/happiercows/jobs/UpdateCowHealthJob::lambda$runUpdateJobInGame$1 → KILLED

116

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_uses_below_capacity_update_strategy_if_equal_to_carrying_capacity()]
changed conditional boundary → KILLED

2.2
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_uses_below_capacity_update_strategy()]
negated conditional → KILLED

117

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_uses_below_capacity_update_strategy()]
negated conditional → KILLED

122

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:two_herds_of_one_farmer_keep_different_health_and_farmer_gets_weighted_average()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

128

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_uses_below_capacity_update_strategy()]
removed call to edu/ucsb/cs156/happiercows/entities/Herd::setHealth → KILLED

130

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_whose_herds_all_die_has_no_cows_and_full_health()]
removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowDeaths → KILLED

2.2
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_whose_herds_all_die_has_no_cows_and_full_health()]
Replaced integer addition with subtraction → KILLED

131

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:two_herds_of_one_farmer_keep_different_health_and_farmer_gets_weighted_average()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

134

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_whose_herds_all_die_has_no_cows_and_full_health()]
negated conditional → KILLED

135

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_whose_herds_all_die_has_no_cows_and_full_health()]
removed call to edu/ucsb/cs156/happiercows/repositories/HerdRepository::delete → KILLED

138

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_uses_below_capacity_update_strategy()]
Replaced integer addition with subtraction → KILLED

139

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:two_herds_of_one_farmer_keep_different_health_and_farmer_gets_weighted_average()]
Replaced double multiplication with division → KILLED

2.2
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:test_uses_below_capacity_update_strategy()]
Replaced double addition with subtraction → KILLED

146

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_with_no_herds_has_no_cows_and_full_health()]
removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setNumOfCows → KILLED

147

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:two_herds_of_one_farmer_keep_different_health_and_farmer_gets_weighted_average()]
Replaced double division with multiplication → KILLED

2.2
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_with_no_herds_has_no_cows_and_full_health()]
changed conditional boundary → KILLED

3.3
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_with_no_herds_has_no_cows_and_full_health()]
negated conditional → KILLED

4.4
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:farmer_with_no_herds_has_no_cows_and_full_health()]
removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowHealth → KILLED

148

1.1
Location : runUpdateJobInGame
Killed by : edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.jobs.UpdateCowHealthJobTests]/[method:two_herds_of_one_farmer_keep_different_health_and_farmer_gets_weighted_average()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1