GameController.java

1
package edu.ucsb.cs156.happiercows.controllers;
2
3
import com.fasterxml.jackson.core.JsonProcessingException;
4
import com.fasterxml.jackson.databind.ObjectMapper;
5
import edu.ucsb.cs156.happiercows.entities.GameStats;
6
import edu.ucsb.cs156.happiercows.entities.Game;
7
import edu.ucsb.cs156.happiercows.entities.GamePlus;
8
import edu.ucsb.cs156.happiercows.entities.User;
9
import edu.ucsb.cs156.happiercows.entities.Farmer;
10
import edu.ucsb.cs156.happiercows.errors.EntityNotFoundException;
11
import edu.ucsb.cs156.happiercows.models.CreateGameParams;
12
import edu.ucsb.cs156.happiercows.models.DashboardSettingsParams;
13
import edu.ucsb.cs156.happiercows.models.HealthUpdateStrategyList;
14
import edu.ucsb.cs156.happiercows.errors.CourseAccessDeniedException;
15
import edu.ucsb.cs156.happiercows.repositories.GameStatsRepository;
16
import edu.ucsb.cs156.happiercows.repositories.GameRepository;
17
import edu.ucsb.cs156.happiercows.repositories.FarmerRepository;
18
import edu.ucsb.cs156.happiercows.services.CourseAccessService;
19
import edu.ucsb.cs156.happiercows.strategies.CowHealthUpdateStrategies;
20
import io.swagger.v3.oas.annotations.tags.Tag;
21
import io.swagger.v3.oas.annotations.Operation;
22
import io.swagger.v3.oas.annotations.Parameter;
23
import org.springframework.beans.factory.annotation.Value;
24
import lombok.extern.slf4j.Slf4j;
25
import org.springframework.beans.factory.annotation.Autowired;
26
import org.springframework.http.HttpStatus;
27
import org.springframework.http.ResponseEntity;
28
import org.springframework.security.access.prepost.PreAuthorize;
29
import org.springframework.web.bind.annotation.*;
30
import edu.ucsb.cs156.happiercows.services.GamePlusBuilderService;
31
32
33
import java.util.ArrayList;
34
import java.util.Comparator;
35
import java.util.List;
36
import java.util.Map;
37
import java.util.Optional;
38
import java.util.stream.Collectors;
39
import java.util.stream.StreamSupport;
40
41
42
@Slf4j
43
@Tag(name = "Game")
44
@RequestMapping("/api/game")
45
@RestController
46
public class GameController extends ApiController {
47
    @Autowired
48
    private GameRepository gameRepository;
49
50
    @Autowired
51
    private FarmerRepository farmerRepository;
52
53
    @Autowired
54
    ObjectMapper mapper;
55
56
    @Autowired
57
    GamePlusBuilderService gamePlusBuilderService;
58
59
    @Autowired
60
    GameStatsRepository gameStatsRepository;
61
62
    @Autowired
63
    CourseAccessService courseAccessService;
64
65
    @Value("${app.game.default.startingBalance}")
66
    private double defaultStartingBalance;
67
68
    @Value("${app.game.default.cowPrice}")
69
    private double defaultCowPrice;
70
71
    @Value("${app.game.default.milkPrice}")
72
    private double defaultMilkPrice;
73
74
    @Value("${app.game.default.degradationRate}")
75
    private double defaultDegradationRate;
76
77
    @Value("${app.game.default.carryingCapacity}")
78
    private int defaultCarryingCapacity;
79
80
    @Value("${app.game.default.capacityPerUser}")
81
    private int defaultCapacityPerUser;
82
83
    @Value("${app.game.default.aboveCapacityHealthUpdateStrategy}")
84
    private String defaultAboveCapacityHealthUpdateStrategy;
85
86
    @Value("${app.game.default.belowCapacityHealthUpdateStrategy}")
87
    private String defaultBelowCapacityHealthUpdateStrategy;
88
89
    @Operation(summary = "Get default common values")
90
    @GetMapping("/defaults")
91
    public ResponseEntity<Game> getDefaultGame() throws JsonProcessingException {
92
        log.info("getDefaultGame()...");
93
94
        Game defaultGame = Game.builder()
95
                .startingBalance(defaultStartingBalance)
96
                .cowPrice(defaultCowPrice)
97
                .milkPrice(defaultMilkPrice)
98
                .degradationRate(defaultDegradationRate)
99
                .carryingCapacity(defaultCarryingCapacity)
100
                .capacityPerUser(defaultCapacityPerUser)
101
                .aboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(defaultAboveCapacityHealthUpdateStrategy))
102
                .belowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(defaultBelowCapacityHealthUpdateStrategy))
103
                .hidden(false)
104
                .build();
105
106 1 1. getDefaultGame : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getDefaultGame → KILLED
        return ResponseEntity.ok().body(defaultGame);
107
    }
108
109
    @Operation(summary = "Get a list of all game")
110
    @GetMapping("/all")
111
    public ResponseEntity<String> getGame() throws JsonProcessingException {
112
        log.info("getGame()...");
113
        Iterable<Game> game = gameRepository.findAll();
114
        String body = mapper.writeValueAsString(game);
115 1 1. getGame : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGame → KILLED
        return ResponseEntity.ok().body(body);
116
    }
117
118
    @Operation(summary = "Get a list of all game and number of cows/users, newest first")
119
    @GetMapping("/allplus")
120
    public ResponseEntity<String> getGamePlus() throws JsonProcessingException {
121
        log.info("getGamePlus()...");
122
        Iterable<Game> gameListIter = gameRepository.findAll();
123
124
        // findAll() has no defined order, so sort newest first for a deterministic response
125
        List<Game> gameList = new ArrayList<>();
126 1 1. getGamePlus : removed call to java/lang/Iterable::forEach → KILLED
        gameListIter.forEach(gameList::add);
127 1 1. getGamePlus : removed call to java/util/List::sort → KILLED
        gameList.sort(Comparator.comparingLong(Game::getId).reversed());
128
129
        Iterable<GamePlus> gamePlusList = gamePlusBuilderService.convertToGamePlus(gameList);
130
131
        String body = mapper.writeValueAsString(gamePlusList);
132 1 1. getGamePlus : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGamePlus → KILLED
        return ResponseEntity.ok().body(body);
133
    }
134
135
    @Operation(summary = "Get the number of cows/users in a game")
136
    @PreAuthorize("hasRole('ROLE_USER')")
137
    @GetMapping("/plus")
138
    public GamePlus getGamePlusById(
139
            @Parameter(name="id") @RequestParam long id) throws JsonProcessingException {
140
                GamePlus gamePlus = gamePlusBuilderService.toGamePlus(gameRepository.findById(id)
141 1 1. lambda$getGamePlusById$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGamePlusById$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException("Game", id)));
142
143 1 1. getGamePlusById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGamePlusById → KILLED
        return gamePlus;
144
    }
145
146
    @Operation(summary = "Update a game")
147
    @PreAuthorize("hasRole('ROLE_ADMIN')")
148
    @PutMapping("/update")
149
    public ResponseEntity<String> updateGame(
150
            @Parameter(name="id") @RequestParam long id,
151
            @Parameter(name="request body") @RequestBody CreateGameParams params
152
    ) {
153
        Optional<Game> existing = gameRepository.findById(id);
154
155
        Game updated;
156
        HttpStatus status;
157
158 1 1. updateGame : negated conditional → KILLED
        if (existing.isPresent()) {
159
            updated = existing.get();
160
            status = HttpStatus.NO_CONTENT;
161
        } else {
162
            updated = new Game();
163
            status = HttpStatus.CREATED;
164
        }
165
166 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setName → KILLED
        updated.setName(params.getName());
167 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setCowPrice → KILLED
        updated.setCowPrice(params.getCowPrice());
168 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setMilkPrice → KILLED
        updated.setMilkPrice(params.getMilkPrice());
169 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setStartingBalance → KILLED
        updated.setStartingBalance(params.getStartingBalance());
170 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setStartingDate → KILLED
        updated.setStartingDate(params.getStartingDate());
171 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setLastDate → KILLED
        updated.setLastDate(params.getLastDate());
172 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowLeaderboard → KILLED
        updated.setShowLeaderboard(params.getShowLeaderboard());
173 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowChat → KILLED
        updated.setShowChat(params.getShowChat());
174 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setDegradationRate → KILLED
        updated.setDegradationRate(params.getDegradationRate());
175 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setCapacityPerUser → KILLED
        updated.setCapacityPerUser(params.getCapacityPerUser());
176 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setCarryingCapacity → KILLED
        updated.setCarryingCapacity(params.getCarryingCapacity());
177 1 1. updateGame : negated conditional → KILLED
        if (params.getAboveCapacityHealthUpdateStrategy() != null) {
178 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setAboveCapacityHealthUpdateStrategy → KILLED
            updated.setAboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getAboveCapacityHealthUpdateStrategy()));
179
        }
180 1 1. updateGame : negated conditional → KILLED
        if (params.getBelowCapacityHealthUpdateStrategy() != null) {
181 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setBelowCapacityHealthUpdateStrategy → KILLED
            updated.setBelowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getBelowCapacityHealthUpdateStrategy()));
182
        }
183
184 2 1. updateGame : changed conditional boundary → KILLED
2. updateGame : negated conditional → KILLED
        if (params.getDegradationRate() < 0) {
185
            throw new IllegalArgumentException("Degradation Rate cannot be negative");
186
        }
187
188
        // Reference: frontend/src/main/components/Game/GameForm.js
189 1 1. updateGame : negated conditional → KILLED
        if (params.getName().equals("")) {
190
            throw new IllegalArgumentException("Name cannot be empty");
191
        }
192
193 2 1. updateGame : negated conditional → KILLED
2. updateGame : changed conditional boundary → KILLED
        if (params.getCowPrice() < 0.01) {
194
            throw new IllegalArgumentException("Cow Price cannot be less than 0.01");
195
        }
196
197 2 1. updateGame : changed conditional boundary → KILLED
2. updateGame : negated conditional → KILLED
        if (params.getMilkPrice() < 0.01) {
198
            throw new IllegalArgumentException("Milk Price cannot be less than 0.01");
199
        }
200
201 2 1. updateGame : negated conditional → KILLED
2. updateGame : changed conditional boundary → KILLED
        if (params.getStartingBalance() < 0) {
202
            throw new IllegalArgumentException("Starting Balance cannot be negative");
203
        }
204
205 2 1. updateGame : changed conditional boundary → KILLED
2. updateGame : negated conditional → KILLED
        if (params.getCarryingCapacity() < 1) {
206
            throw new IllegalArgumentException("Carrying Capacity cannot be less than 1");
207
        }
208
209 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/controllers/GameController::validateDates → KILLED
        validateDates(params);
210
211 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setHidden → KILLED
        updated.setHidden(params.isHidden());
212 1 1. updateGame : removed call to edu/ucsb/cs156/happiercows/entities/Game::setCourseId → KILLED
        updated.setCourseId(params.getCourseId());
213
        gameRepository.save(updated);
214
215 1 1. updateGame : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::updateGame → KILLED
        return ResponseEntity.status(status).build();
216
    }
217
218
    @Operation(summary = "Get a specific game")
219
    @PreAuthorize("hasRole('ROLE_USER')")
220
    @GetMapping("")
221
    public Game getGameById(
222
            @Parameter(name="id") @RequestParam Long id) throws JsonProcessingException {
223
224
        Game game = gameRepository.findById(id)
225 1 1. lambda$getGameById$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameById$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException("Game", id));
226
227 1 1. getGameById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGameById → KILLED
        return game;
228
    }
229
230
    @Operation(summary = "Create a new game")
231
    @PreAuthorize("hasRole('ROLE_ADMIN')")
232
    @PostMapping(value = "/new", produces = "application/json")
233
    public ResponseEntity<String> createGame(
234
            @Parameter(name="request body") @RequestBody CreateGameParams params
235
    ) throws JsonProcessingException {
236
237
        var builder = Game.builder()
238
                .name(params.getName())
239
                .cowPrice(params.getCowPrice())
240
                .milkPrice(params.getMilkPrice())
241
                .startingBalance(params.getStartingBalance())
242
                .startingDate(params.getStartingDate())
243
                .lastDate(params.getLastDate())
244
                .degradationRate(params.getDegradationRate())
245
                .showLeaderboard(params.getShowLeaderboard())
246
                .showChat(params.getShowChat())
247
                .capacityPerUser(params.getCapacityPerUser())
248
                .carryingCapacity(params.getCarryingCapacity())
249
                .hidden(params.isHidden())
250
                .courseId(params.getCourseId());
251
252
        // ok to set null values for these, so old backend still works
253 1 1. createGame : negated conditional → KILLED
        if (params.getAboveCapacityHealthUpdateStrategy() != null) {
254
            builder.aboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getAboveCapacityHealthUpdateStrategy()));
255
        }
256 1 1. createGame : negated conditional → KILLED
        if (params.getBelowCapacityHealthUpdateStrategy() != null) {
257
            builder.belowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getBelowCapacityHealthUpdateStrategy()));
258
        }
259
260
        Game game = builder.build();
261
262
        // Reference: frontend/src/main/components/Game/GameForm.js
263 1 1. createGame : negated conditional → KILLED
        if (params.getName().equals("")) {
264
            throw new IllegalArgumentException("Name cannot be empty");
265
        }
266
267 2 1. createGame : changed conditional boundary → KILLED
2. createGame : negated conditional → KILLED
        if (params.getCowPrice() < 0.01) {
268
            throw new IllegalArgumentException("Cow Price cannot be less than 0.01");
269
        }
270
271 2 1. createGame : changed conditional boundary → KILLED
2. createGame : negated conditional → KILLED
        if (params.getMilkPrice() < 0.01) {
272
            throw new IllegalArgumentException("Milk Price cannot be less than 0.01");
273
        }
274
275 2 1. createGame : negated conditional → KILLED
2. createGame : changed conditional boundary → KILLED
        if (params.getStartingBalance() < 0) {
276
            throw new IllegalArgumentException("Starting Balance cannot be negative");
277
        }
278
279
        // throw exception for degradation rate
280 2 1. createGame : negated conditional → KILLED
2. createGame : changed conditional boundary → KILLED
        if (params.getDegradationRate() < 0) {
281
            throw new IllegalArgumentException("Degradation Rate cannot be negative");
282
        }
283
284 2 1. createGame : negated conditional → KILLED
2. createGame : changed conditional boundary → KILLED
        if (params.getCarryingCapacity() < 1) {
285
            throw new IllegalArgumentException("Carrying Capacity cannot be less than 1");
286
        }
287
288 1 1. createGame : removed call to edu/ucsb/cs156/happiercows/controllers/GameController::validateDates → KILLED
        validateDates(params);
289
290
        Game saved = gameRepository.save(game);
291
        String body = mapper.writeValueAsString(saved);
292
293 1 1. createGame : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::createGame → KILLED
        return ResponseEntity.ok().body(body);
294
    }
295
296
    /**
297
     * Enforce that both dates are present and that the last date is strictly
298
     * after the starting date.  (See issue #250; the frontend form enforces
299
     * the same rules, but the backend must not rely on that.)
300
     *
301
     * @param params the params to validate
302
     */
303
    public static void validateDates(CreateGameParams params) {
304 1 1. validateDates : negated conditional → KILLED
        if (params.getStartingDate() == null) {
305
            throw new IllegalArgumentException("Starting Date is required");
306
        }
307 1 1. validateDates : negated conditional → KILLED
        if (params.getLastDate() == null) {
308
            throw new IllegalArgumentException("Last Date is required");
309
        }
310 1 1. validateDates : negated conditional → KILLED
        if (!params.getLastDate().isAfter(params.getStartingDate())) {
311
            throw new IllegalArgumentException("Last Date must be after Starting Date");
312
        }
313
    }
314
315
316
    @Operation(summary = "List all cow health update strategies")
317
    @PreAuthorize("hasRole('ROLE_USER')")
318
    @GetMapping("/all-health-update-strategies")
319
    public ResponseEntity<String> listCowHealthUpdateStrategies() throws JsonProcessingException {
320
        var result = HealthUpdateStrategyList.create();
321
        String body = mapper.writeValueAsString(result);
322 1 1. listCowHealthUpdateStrategies : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::listCowHealthUpdateStrategies → KILLED
        return ResponseEntity.ok().body(body);
323
    }
324
325
    @Operation(summary = "Get the ids of the courses the current user belongs to as a student or staff member")
326
    @PreAuthorize("hasRole('ROLE_USER')")
327
    @GetMapping("/mycourses")
328
    public ResponseEntity<List<Long>> getMyCourseIds() {
329
        User u = getCurrentUser().getUser();
330
        List<Long> courseIds = courseAccessService.getCourseIdsForUser(u);
331 1 1. getMyCourseIds : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getMyCourseIds → KILLED
        return ResponseEntity.ok().body(courseIds);
332
    }
333
334
    @Operation(summary = "Join a game")
335
    @PreAuthorize("hasRole('ROLE_USER')")
336
    @PostMapping(value = "/join", produces = "application/json")
337
    public ResponseEntity<String> joinCommon(
338
            @Parameter(name="gameId") @RequestParam Long gameId) throws Exception {
339
340
        User u = getCurrentUser().getUser();
341
        Long userId = u.getId();
342
        String username = u.getFullName();
343
344
        Game joinedGame = gameRepository.findById(gameId)
345 1 1. lambda$joinCommon$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$joinCommon$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException("Game", gameId));
346
347 2 1. joinCommon : negated conditional → KILLED
2. joinCommon : negated conditional → KILLED
        if (joinedGame.getCourseId() != null && !courseAccessService.isEligibleForGame(u, joinedGame)) {
348
            throw new CourseAccessDeniedException(gameId);
349
        }
350
351
        Optional<Farmer> farmerLookup = farmerRepository.findByGameIdAndUserId(gameId, userId);
352
353 1 1. joinCommon : negated conditional → KILLED
        if (farmerLookup.isPresent()) {
354
            // user is already a member of this game
355
            String body = mapper.writeValueAsString(joinedGame);
356 1 1. joinCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::joinCommon → KILLED
            return ResponseEntity.ok().body(body);
357
        }
358
359
        Farmer uc = Farmer.builder()
360
                .user(u)
361
                .game(joinedGame)
362
                .username(username)
363
                .totalWealth(joinedGame.getStartingBalance())
364
                .numOfCows(0)
365
                .cowHealth(100)
366
                .cowsBought(0)
367
                .cowsSold(0)
368
                .cowDeaths(0)
369
                .build();
370
371
        farmerRepository.save(uc);
372
373
        String body = mapper.writeValueAsString(joinedGame);
374 1 1. joinCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::joinCommon → KILLED
        return ResponseEntity.ok().body(body);
375
    }
376
377
    @Operation(summary = "Delete a Game")
378
    @PreAuthorize("hasRole('ROLE_ADMIN')")
379
    @DeleteMapping("")
380
    public Object deleteGame(
381
            @Parameter(name="id") @RequestParam Long id) {
382
        
383
        Iterable<Farmer> farmer = farmerRepository.findByGameId(id);
384
385
        for (Farmer game : farmer) {
386 1 1. deleteGame : removed call to edu/ucsb/cs156/happiercows/repositories/FarmerRepository::delete → KILLED
            farmerRepository.delete(game);
387
        }
388
389
        gameRepository.findById(id)
390 1 1. lambda$deleteGame$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$deleteGame$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException("Game", id));
391
392 1 1. deleteGame : removed call to edu/ucsb/cs156/happiercows/repositories/GameRepository::deleteById → KILLED
        gameRepository.deleteById(id);
393
394
        String responseString = String.format("game with id %d deleted", id);
395 1 1. deleteGame : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::deleteGame → KILLED
        return genericMessage(responseString);
396
397
    }
398
399
    @Operation(summary="Delete a user from a game")
400
    @PreAuthorize("hasRole('ROLE_ADMIN')")
401
    @DeleteMapping("/{gameId}/users/{userId}")
402
    public Object deleteUserFromCommon(@PathVariable("gameId") Long gameId,
403
                                       @PathVariable("userId") Long userId) throws Exception {
404
405
        Farmer farmer = farmerRepository.findByGameIdAndUserId(gameId, userId)
406 1 1. lambda$deleteUserFromCommon$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$deleteUserFromCommon$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(
407
                        Farmer.class, "gameId", gameId, "userId", userId)
408
                );
409
410 1 1. deleteUserFromCommon : removed call to edu/ucsb/cs156/happiercows/repositories/FarmerRepository::delete → KILLED
        farmerRepository.delete(farmer);
411
412
        String responseString = String.format("user with id %d deleted from game with id %d, %d users remain", userId, gameId, gameRepository.getNumUsers(gameId).orElse(0));
413
414 1 1. deleteUserFromCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::deleteUserFromCommon → KILLED
        return genericMessage(responseString);
415
    }
416
417
    @Operation(summary = "Update the dashboard visibility settings for a game (admin only)")
418
    @PreAuthorize("hasRole('ROLE_ADMIN')")
419
    @PutMapping("/dashboardSettings")
420
    public ResponseEntity<Game> updateDashboardSettings(
421
            @Parameter(name="id") @RequestParam long id,
422
            @Parameter(name="request body") @RequestBody DashboardSettingsParams params
423
    ) {
424
        Game game = gameRepository.findById(id)
425 1 1. lambda$updateDashboardSettings$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$updateDashboardSettings$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException("Game", id));
426
427 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowLeaderboard → KILLED
        game.setShowLeaderboard(params.isShowLeaderboard());
428 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowOverviewSection → KILLED
        game.setShowOverviewSection(params.isShowOverviewSection());
429 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowCowsPerFarmerSection → KILLED
        game.setShowCowsPerFarmerSection(params.isShowCowsPerFarmerSection());
430 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowCapacitySection → KILLED
        game.setShowCapacitySection(params.isShowCapacitySection());
431 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowHistogramSection → KILLED
        game.setShowHistogramSection(params.isShowHistogramSection());
432 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowTrendsSection → KILLED
        game.setShowTrendsSection(params.isShowTrendsSection());
433 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowHealthSection → KILLED
        game.setShowHealthSection(params.isShowHealthSection());
434 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowTotalCowsSection → KILLED
        game.setShowTotalCowsSection(params.isShowTotalCowsSection());
435 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowCapacityOverTimeSection → KILLED
        game.setShowCapacityOverTimeSection(params.isShowCapacityOverTimeSection());
436 1 1. updateDashboardSettings : removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowFarmerLeaderboardSection → KILLED
        game.setShowFarmerLeaderboardSection(params.isShowFarmerLeaderboardSection());
437
438
        Game saved = gameRepository.save(game);
439
440 1 1. updateDashboardSettings : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::updateDashboardSettings → KILLED
        return ResponseEntity.ok().body(saved);
441
    }
442
443
    @Operation(summary = "Get the number of cows for each farmer in a game")
444
    @PreAuthorize("hasRole('ROLE_USER')")
445
    @GetMapping("/numcows")
446
    public ResponseEntity<List<Integer>> getNumCowsForGameId(
447
            @Parameter(name="gameId") @RequestParam Long gameId) {
448
        Iterable<Farmer> farmerList = farmerRepository.findByGameId(gameId);
449
        List<Integer> numCowsList = StreamSupport.stream(farmerList.spliterator(), false)
450
                .map(Farmer::getNumOfCows)
451
                .collect(Collectors.toList());
452 1 1. getNumCowsForGameId : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getNumCowsForGameId → KILLED
        return ResponseEntity.ok().body(numCowsList);
453
    }
454
455
    @Operation(summary = "Get timeseries stats for a game")
456
    @PreAuthorize("hasRole('ROLE_USER')")
457
    @GetMapping("/timeseries")
458
    public ResponseEntity<List<Map<String, Object>>> getGameTimeSeries(
459
            @Parameter(name="commonId") @RequestParam Long commonId) {
460
        Iterable<GameStats> gameStats = gameStatsRepository.findAllByGameId(commonId);
461
        List<GameStats> sortedStats = StreamSupport.stream(gameStats.spliterator(), false)
462
                .sorted(Comparator.comparing(GameStats::getCreateDate))
463
                .collect(Collectors.toList());
464
465
        List<Map<String, Object>> healthValues = sortedStats.stream()
466 1 1. lambda$getGameTimeSeries$0 : replaced return value with Collections.emptyMap for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameTimeSeries$0 → KILLED
                .map(stat -> Map.<String, Object>of(
467
                        "date", stat.getCreateDate().toString(),
468
                        "value", stat.getAvgHealth()))
469
                .collect(Collectors.toList());
470
471
        List<Map<String, Object>> totalCowsValues = sortedStats.stream()
472 1 1. lambda$getGameTimeSeries$1 : replaced return value with Collections.emptyMap for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameTimeSeries$1 → KILLED
                .map(stat -> Map.<String, Object>of(
473
                        "date", stat.getCreateDate().toString(),
474
                        "value", stat.getNumCows()))
475
                .collect(Collectors.toList());
476
477
        List<Map<String, Object>> effectiveCapacityValues = sortedStats.stream()
478 1 1. lambda$getGameTimeSeries$2 : replaced return value with Collections.emptyMap for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameTimeSeries$2 → KILLED
                .map(stat -> Map.<String, Object>of(
479
                        "date", stat.getCreateDate().toString(),
480
                        "value", stat.getEffectiveCapacity()))
481
                .collect(Collectors.toList());
482
483
        List<Map<String, Object>> timeSeries = List.of(
484
                Map.of(
485
                        "name", "Health",
486
                        "color", "#0088FE",
487
                        "percentage", true,
488
                        "values", healthValues),
489
                Map.of(
490
                        "name", "Total Cows",
491
                        "color", "#FF8042",
492
                        "values", totalCowsValues),
493
                Map.of(
494
                        "name", "Effective Capacity",
495
                        "color", "#00C49F",
496
                        "values", effectiveCapacityValues));
497
498 1 1. getGameTimeSeries : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGameTimeSeries → KILLED
        return ResponseEntity.ok().body(timeSeries);
499
    }
500
501
    
502
}

Mutations

106

1.1
Location : getDefaultGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getDefaultGameValuesTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getDefaultGame → KILLED

115

1.1
Location : getGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGame → KILLED

126

1.1
Location : getGamePlus
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGamePlusTest()]
removed call to java/lang/Iterable::forEach → KILLED

127

1.1
Location : getGamePlus
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGamePlusTest_returnsGameSortedNewestFirst()]
removed call to java/util/List::sort → KILLED

132

1.1
Location : getGamePlus
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGamePlusTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGamePlus → KILLED

141

1.1
Location : lambda$getGamePlusById$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGamePlusByIdTest_invalid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGamePlusById$0 → KILLED

143

1.1
Location : getGamePlusById
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGamePlusByIdTest_valid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGamePlusById → KILLED

158

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_lastDateMissing_badRequest()]
negated conditional → KILLED

166

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setName → KILLED

167

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setCowPrice → KILLED

168

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setMilkPrice → KILLED

169

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setStartingBalance → KILLED

170

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setStartingDate → KILLED

171

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setLastDate → KILLED

172

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowLeaderboard → KILLED

173

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowChat → KILLED

174

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setDegradationRate → KILLED

175

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setCapacityPerUser → KILLED

176

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setCarryingCapacity → KILLED

177

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_lastDateMissing_badRequest()]
negated conditional → KILLED

178

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setAboveCapacityHealthUpdateStrategy → KILLED

180

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_lastDateMissing_badRequest()]
negated conditional → KILLED

181

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setBelowCapacityHealthUpdateStrategy → KILLED

184

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

2.2
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
negated conditional → KILLED

189

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
negated conditional → KILLED

193

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
negated conditional → KILLED

2.2
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

197

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

2.2
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
negated conditional → KILLED

201

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
negated conditional → KILLED

2.2
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

205

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

2.2
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
negated conditional → KILLED

209

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_lastDateMissing_badRequest()]
removed call to edu/ucsb/cs156/happiercows/controllers/GameController::validateDates → KILLED

211

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setHidden → KILLED

212

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_setsCourseId()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setCourseId → KILLED

215

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:UpdateGameTest_withBoundaryParameters()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::updateGame → KILLED

225

1.1
Location : lambda$getGameById$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameByIdTest_invalid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameById$0 → KILLED

227

1.1
Location : getGameById
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameByIdTest_valid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGameById → KILLED

253

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

256

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

263

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

267

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

2.2
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

271

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

2.2
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

275

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

2.2
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

280

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

2.2
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

284

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

2.2
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
changed conditional boundary → KILLED

288

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_lastDateMissing_badRequest()]
removed call to edu/ucsb/cs156/happiercows/controllers/GameController::validateDates → KILLED

293

1.1
Location : createGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_zeroDegradation()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::createGame → KILLED

304

1.1
Location : validateDates
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

307

1.1
Location : validateDates
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

310

1.1
Location : validateDates
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:createGameTest_withBoundaryParameters()]
negated conditional → KILLED

322

1.1
Location : listCowHealthUpdateStrategies
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getHealthUpdateStrategiesTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::listCowHealthUpdateStrategies → KILLED

331

1.1
Location : getMyCourseIds
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getMyCourseIdsTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getMyCourseIds → KILLED

345

1.1
Location : lambda$joinCommon$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:join_when_game_with_id_does_not_exist()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$joinCommon$0 → KILLED

347

1.1
Location : joinCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:already_joined_common_test()]
negated conditional → KILLED

2.2
Location : joinCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:join_denied_when_user_not_eligible_for_course_linked_game()]
negated conditional → KILLED

353

1.1
Location : joinCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:joinGameTest()]
negated conditional → KILLED

356

1.1
Location : joinCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:already_joined_common_test()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::joinCommon → KILLED

374

1.1
Location : joinCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:joinGameTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::joinCommon → KILLED

386

1.1
Location : deleteGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteGame_test_admin_exists()]
removed call to edu/ucsb/cs156/happiercows/repositories/FarmerRepository::delete → KILLED

390

1.1
Location : lambda$deleteGame$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteGame_test_admin_nonexists()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$deleteGame$0 → KILLED

392

1.1
Location : deleteGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteGame_test_admin_exists()]
removed call to edu/ucsb/cs156/happiercows/repositories/GameRepository::deleteById → KILLED

395

1.1
Location : deleteGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteGame_test_admin_exists()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::deleteGame → KILLED

406

1.1
Location : lambda$deleteUserFromCommon$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteUserFromGame_when_not_joined()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$deleteUserFromCommon$0 → KILLED

410

1.1
Location : deleteUserFromCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteUserFromGameTest()]
removed call to edu/ucsb/cs156/happiercows/repositories/FarmerRepository::delete → KILLED

414

1.1
Location : deleteUserFromCommon
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:deleteUserFromGameTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::deleteUserFromCommon → KILLED

425

1.1
Location : lambda$updateDashboardSettings$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_not_found()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$updateDashboardSettings$0 → KILLED

427

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowLeaderboard → KILLED

428

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowOverviewSection → KILLED

429

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowCowsPerFarmerSection → KILLED

430

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowCapacitySection → KILLED

431

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowHistogramSection → KILLED

432

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowTrendsSection → KILLED

433

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowHealthSection → KILLED

434

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowTotalCowsSection → KILLED

435

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowCapacityOverTimeSection → KILLED

436

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowFarmerLeaderboardSection → KILLED

440

1.1
Location : updateDashboardSettings
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateDashboardSettings_admin_ok()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::updateDashboardSettings → KILLED

452

1.1
Location : getNumCowsForGameId
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getNumCowsForGameId_user_no_farmers()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getNumCowsForGameId → KILLED

466

1.1
Location : lambda$getGameTimeSeries$0
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameTimeSeries_user_ok_multiple_stats()]
replaced return value with Collections.emptyMap for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameTimeSeries$0 → KILLED

472

1.1
Location : lambda$getGameTimeSeries$1
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameTimeSeries_user_ok_multiple_stats()]
replaced return value with Collections.emptyMap for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameTimeSeries$1 → KILLED

478

1.1
Location : lambda$getGameTimeSeries$2
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameTimeSeries_user_ok_multiple_stats()]
replaced return value with Collections.emptyMap for edu/ucsb/cs156/happiercows/controllers/GameController::lambda$getGameTimeSeries$2 → KILLED

498

1.1
Location : getGameTimeSeries
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:getGameTimeSeries_user_ok_multiple_stats()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/GameController::getGameTimeSeries → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1