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

Mutations

107

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

116

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

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()]
removed call to java/lang/Iterable::forEach → KILLED

128

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

133

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

142

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

144

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

159

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_startingDateMissing_badRequest()]
negated conditional → 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::setName → 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::setCowPrice → 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_withPurchaseAndSellingFees()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setPurchaseFee → 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_withPurchaseAndSellingFees()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setSellingFee → 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::setMilkPrice → 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_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setStartingBalance → 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_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setStartingDate → 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::setLastDate → 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()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowLeaderboard → 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()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setShowChat → 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_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setDegradationRate → 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_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setCapacityPerUser → KILLED

179

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

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_startingDateMissing_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::setAboveCapacityHealthUpdateStrategy → KILLED

183

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_startingDateMissing_badRequest()]
negated conditional → 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()]
removed call to edu/ucsb/cs156/happiercows/entities/Game::setBelowCapacityHealthUpdateStrategy → KILLED

187

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_withPurchaseAndSellingFees()]
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

192

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

196

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_withPurchaseAndSellingFees()]
negated conditional → KILLED

200

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_withPurchaseAndSellingFees()]
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

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

204

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_withPurchaseAndSellingFees()]
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

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

208

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_withPurchaseAndSellingFees()]
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

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_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_withPurchaseAndSellingFees()]
negated conditional → KILLED

216

1.1
Location : updateGame
Killed by : edu.ucsb.cs156.happiercows.controllers.GameControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.GameControllerTests]/[method:updateGameTest_withPurchaseAndSellingFees()]
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

220

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

222

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

223

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

226

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

236

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

238

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

266

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

269

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

276

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

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()]
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

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()]
negated conditional → KILLED

3.3
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_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

3.3
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

292

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

296

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

301

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

305

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

309

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

314

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

325

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

328

1.1
Location : validateDates
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

331

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

343

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

352

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

366

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

368

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

372

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

378

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

381

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

399

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

411

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

415

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

417

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

420

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

431

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

435

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

439

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

450

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

452

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

453

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

454

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

455

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

456

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

457

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

458

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

459

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

460

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

461

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

465

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

477

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

491

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

497

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

503

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

523

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