CommonsController.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.Commons;
6
import edu.ucsb.cs156.happiercows.entities.CommonsPlus;
7
import edu.ucsb.cs156.happiercows.entities.User;
8
import edu.ucsb.cs156.happiercows.entities.UserCommons;
9
import edu.ucsb.cs156.happiercows.errors.EntityNotFoundException;
10
import edu.ucsb.cs156.happiercows.errors.CommonsHiddenException;
11
import edu.ucsb.cs156.happiercows.models.CreateCommonsParams;
12
import edu.ucsb.cs156.happiercows.models.HealthUpdateStrategyList;
13
import edu.ucsb.cs156.happiercows.repositories.CommonsRepository;
14
import edu.ucsb.cs156.happiercows.repositories.UserCommonsRepository;
15
import edu.ucsb.cs156.happiercows.strategies.CowHealthUpdateStrategies;
16
import io.swagger.v3.oas.annotations.tags.Tag;
17
import io.swagger.v3.oas.annotations.Operation;
18
import io.swagger.v3.oas.annotations.Parameter;
19
import org.springframework.beans.factory.annotation.Value;
20
import lombok.extern.slf4j.Slf4j;
21
import org.springframework.beans.factory.annotation.Autowired;
22
import org.springframework.http.HttpStatus;
23
import org.springframework.http.ResponseEntity;
24
import org.springframework.security.access.prepost.PreAuthorize;
25
import org.springframework.web.bind.annotation.*;
26
import edu.ucsb.cs156.happiercows.services.CommonsPlusBuilderService;
27
28
29
import java.util.Optional;
30
31
32
@Slf4j
33
@Tag(name = "Commons")
34
@RequestMapping("/api/commons")
35
@RestController
36
public class CommonsController extends ApiController {
37
    @Autowired
38
    private CommonsRepository commonsRepository;
39
40
    @Autowired
41
    private UserCommonsRepository userCommonsRepository;
42
43
    @Autowired
44
    ObjectMapper mapper;
45
46
    @Autowired
47
    CommonsPlusBuilderService commonsPlusBuilderService;
48
49
    @Value("${app.commons.default.startingBalance}")
50
    private double defaultStartingBalance;
51
52
    @Value("${app.commons.default.cowPrice}")
53
    private double defaultCowPrice;
54
55
    @Value("${app.commons.default.milkPrice}")
56
    private double defaultMilkPrice;
57
58
    @Value("${app.commons.default.degradationRate}")
59
    private double defaultDegradationRate;
60
61
    @Value("${app.commons.default.carryingCapacity}")
62
    private int defaultCarryingCapacity;
63
64
    @Value("${app.commons.default.capacityPerUser}")
65
    private int defaultCapacityPerUser;
66
67
    @Value("${app.commons.default.aboveCapacityHealthUpdateStrategy}")
68
    private String defaultAboveCapacityHealthUpdateStrategy;
69
70
    @Value("${app.commons.default.belowCapacityHealthUpdateStrategy}")
71
    private String defaultBelowCapacityHealthUpdateStrategy;
72
73
    @Operation(summary = "Get default common values")
74
    @GetMapping("/defaults")
75
    public ResponseEntity<Commons> getDefaultCommons() throws JsonProcessingException {
76
        log.info("getDefaultCommons()...");
77
78
        Commons defaultCommons = Commons.builder()
79
                .startingBalance(defaultStartingBalance)
80
                .cowPrice(defaultCowPrice)
81
                .milkPrice(defaultMilkPrice)
82
                .degradationRate(defaultDegradationRate)
83
                .carryingCapacity(defaultCarryingCapacity)
84
                .capacityPerUser(defaultCapacityPerUser)
85
                .aboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(defaultAboveCapacityHealthUpdateStrategy))
86
                .belowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(defaultBelowCapacityHealthUpdateStrategy))
87
                .hidden(false)
88
                .build();
89
90 1 1. getDefaultCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getDefaultCommons → KILLED
        return ResponseEntity.ok().body(defaultCommons);
91
    }
92
93
    @Operation(summary = "Get a list of all commons")
94
    @GetMapping("/all")
95
    public ResponseEntity<String> getCommons() throws JsonProcessingException {
96
        log.info("getCommons()...");
97
        Iterable<Commons> commons = commonsRepository.findAll();
98
        String body = mapper.writeValueAsString(commons);
99 1 1. getCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommons → KILLED
        return ResponseEntity.ok().body(body);
100
    }
101
102
    @Operation(summary = "Get a list of all commons and number of cows/users")
103
    @GetMapping("/allplus")
104
    public ResponseEntity<String> getCommonsPlus() throws JsonProcessingException {
105
        log.info("getCommonsPlus()...");
106
        Iterable<Commons> commonsListIter = commonsRepository.findAll();
107
108
        // convert Iterable to List for the purposes of using a Java Stream & lambda
109
        // below
110
        Iterable<CommonsPlus> commonsPlusList = commonsPlusBuilderService.convertToCommonsPlus(commonsListIter);
111
112
        String body = mapper.writeValueAsString(commonsPlusList);
113 1 1. getCommonsPlus : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsPlus → KILLED
        return ResponseEntity.ok().body(body);
114
    }
115
116
    @Operation(summary = "Get the number of cows/users in a commons")
117
    @PreAuthorize("hasRole('ROLE_USER')")
118
    @GetMapping("/plus")
119
    public CommonsPlus getCommonsPlusById(
120
            @Parameter(name="id") @RequestParam long id) throws JsonProcessingException {
121
                CommonsPlus commonsPlus = commonsPlusBuilderService.toCommonsPlus(commonsRepository.findById(id)
122 1 1. lambda$getCommonsPlusById$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$getCommonsPlusById$0 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(Commons.class, id)));
123
124 1 1. getCommonsPlusById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsPlusById → KILLED
        return commonsPlus;
125
    }
126
127
    @Operation(summary = "Update a commons")
128
    @PreAuthorize("hasRole('ROLE_ADMIN')")
129
    @PutMapping("/update")
130
    public ResponseEntity<String> updateCommons(
131
            @Parameter(name="id") @RequestParam long id,
132
            @Parameter(name="request body") @RequestBody CreateCommonsParams params
133
    ) {
134
        Optional<Commons> existing = commonsRepository.findById(id);
135
136
        Commons updated;
137
        HttpStatus status;
138
139 1 1. updateCommons : negated conditional → KILLED
        if (existing.isPresent()) {
140
            updated = existing.get();
141
            status = HttpStatus.NO_CONTENT;
142
        } else {
143
            updated = new Commons();
144
            status = HttpStatus.CREATED;
145
        }
146
147 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setName → KILLED
        updated.setName(params.getName());
148 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCowPrice → KILLED
        updated.setCowPrice(params.getCowPrice());
149 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setMilkPrice → KILLED
        updated.setMilkPrice(params.getMilkPrice());
150 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingBalance → KILLED
        updated.setStartingBalance(params.getStartingBalance());
151 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingDate → KILLED
        updated.setStartingDate(params.getStartingDate());
152 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setLastDate → KILLED
        updated.setLastDate(params.getLastDate());
153 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowLeaderboard → KILLED
        updated.setShowLeaderboard(params.getShowLeaderboard());
154 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowChat → KILLED
        updated.setShowChat(params.getShowChat());
155 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setDegradationRate → KILLED
        updated.setDegradationRate(params.getDegradationRate());
156 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCapacityPerUser → KILLED
        updated.setCapacityPerUser(params.getCapacityPerUser());
157 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCarryingCapacity → KILLED
        updated.setCarryingCapacity(params.getCarryingCapacity());
158 1 1. updateCommons : negated conditional → KILLED
        if (params.getAboveCapacityHealthUpdateStrategy() != null) {
159 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setAboveCapacityHealthUpdateStrategy → KILLED
            updated.setAboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getAboveCapacityHealthUpdateStrategy()));
160
        }
161 1 1. updateCommons : negated conditional → KILLED
        if (params.getBelowCapacityHealthUpdateStrategy() != null) {
162 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setBelowCapacityHealthUpdateStrategy → KILLED
            updated.setBelowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getBelowCapacityHealthUpdateStrategy()));
163
        }
164
165 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getDegradationRate() < 0) {
166
            throw new IllegalArgumentException("Degradation Rate cannot be negative");
167
        }
168
169
        // Reference: frontend/src/main/components/Commons/CommonsForm.js
170 1 1. updateCommons : negated conditional → KILLED
        if (params.getName().equals("")) {
171
            throw new IllegalArgumentException("Name cannot be empty");
172
        }
173
174 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getCowPrice() < 0.01) {
175
            throw new IllegalArgumentException("Cow Price cannot be less than 0.01");
176
        }
177
178 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getMilkPrice() < 0.01) {
179
            throw new IllegalArgumentException("Milk Price cannot be less than 0.01");
180
        }
181
182 2 1. updateCommons : negated conditional → KILLED
2. updateCommons : changed conditional boundary → KILLED
        if (params.getStartingBalance() < 0) {
183
            throw new IllegalArgumentException("Starting Balance cannot be negative");
184
        }
185
186 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getCarryingCapacity() < 1) {
187
            throw new IllegalArgumentException("Carrying Capacity cannot be less than 1");
188
        }
189
190 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setHidden → KILLED
        updated.setHidden(params.isHidden());
191
        commonsRepository.save(updated);
192
193 1 1. updateCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::updateCommons → KILLED
        return ResponseEntity.status(status).build();
194
    }
195
196
    @Operation(summary = "Get a specific commons")
197
    @PreAuthorize("hasRole('ROLE_USER')")
198
    @GetMapping("")
199
    public Commons getCommonsById(
200
            @Parameter(name="id") @RequestParam Long id) throws JsonProcessingException {
201
202
        Commons commons = commonsRepository.findById(id)
203 1 1. lambda$getCommonsById$1 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$getCommonsById$1 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(Commons.class, id));
204
205 1 1. getCommonsById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsById → KILLED
        return commons;
206
    }
207
208
    @Operation(summary = "Create a new commons")
209
    @PreAuthorize("hasRole('ROLE_ADMIN')")
210
    @PostMapping(value = "/new", produces = "application/json")
211
    public ResponseEntity<String> createCommons(
212
            @Parameter(name="request body") @RequestBody CreateCommonsParams params
213
    ) throws JsonProcessingException {
214
215
        var builder = Commons.builder()
216
                .name(params.getName())
217
                .cowPrice(params.getCowPrice())
218
                .milkPrice(params.getMilkPrice())
219
                .startingBalance(params.getStartingBalance())
220
                .startingDate(params.getStartingDate())
221
                .lastDate(params.getLastDate())
222
                .degradationRate(params.getDegradationRate())
223
                .showLeaderboard(params.getShowLeaderboard())
224
                .showChat(params.getShowChat())
225
                .capacityPerUser(params.getCapacityPerUser())
226
                .carryingCapacity(params.getCarryingCapacity())
227
                .hidden(params.isHidden());
228
229
        // ok to set null values for these, so old backend still works
230 1 1. createCommons : negated conditional → KILLED
        if (params.getAboveCapacityHealthUpdateStrategy() != null) {
231
            builder.aboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getAboveCapacityHealthUpdateStrategy()));
232
        }
233 1 1. createCommons : negated conditional → KILLED
        if (params.getBelowCapacityHealthUpdateStrategy() != null) {
234
            builder.belowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getBelowCapacityHealthUpdateStrategy()));
235
        }
236
237
        Commons commons = builder.build();
238
239
        // Reference: frontend/src/main/components/Commons/CommonsForm.js
240 1 1. createCommons : negated conditional → KILLED
        if (params.getName().equals("")) {
241
            throw new IllegalArgumentException("Name cannot be empty");
242
        }
243
244 2 1. createCommons : negated conditional → KILLED
2. createCommons : changed conditional boundary → KILLED
        if (params.getCowPrice() < 0.01) {
245
            throw new IllegalArgumentException("Cow Price cannot be less than 0.01");
246
        }
247
248 2 1. createCommons : changed conditional boundary → KILLED
2. createCommons : negated conditional → KILLED
        if (params.getMilkPrice() < 0.01) {
249
            throw new IllegalArgumentException("Milk Price cannot be less than 0.01");
250
        }
251
252 2 1. createCommons : negated conditional → KILLED
2. createCommons : changed conditional boundary → KILLED
        if (params.getStartingBalance() < 0) {
253
            throw new IllegalArgumentException("Starting Balance cannot be negative");
254
        }
255
256
        // throw exception for degradation rate
257 2 1. createCommons : negated conditional → KILLED
2. createCommons : changed conditional boundary → KILLED
        if (params.getDegradationRate() < 0) {
258
            throw new IllegalArgumentException("Degradation Rate cannot be negative");
259
        }
260
261 2 1. createCommons : negated conditional → KILLED
2. createCommons : changed conditional boundary → KILLED
        if (params.getCarryingCapacity() < 1) {
262
            throw new IllegalArgumentException("Carrying Capacity cannot be less than 1");
263
        }
264
265
        Commons saved = commonsRepository.save(commons);
266
        String body = mapper.writeValueAsString(saved);
267
268 1 1. createCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::createCommons → KILLED
        return ResponseEntity.ok().body(body);
269
    }
270
271
272
    @Operation(summary = "List all cow health update strategies")
273
    @PreAuthorize("hasRole('ROLE_USER')")
274
    @GetMapping("/all-health-update-strategies")
275
    public ResponseEntity<String> listCowHealthUpdateStrategies() throws JsonProcessingException {
276
        var result = HealthUpdateStrategyList.create();
277
        String body = mapper.writeValueAsString(result);
278 1 1. listCowHealthUpdateStrategies : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::listCowHealthUpdateStrategies → KILLED
        return ResponseEntity.ok().body(body);
279
    }
280
281
    @Operation(summary = "Join a commons")
282
    @PreAuthorize("hasRole('ROLE_USER')")
283
    @PostMapping(value = "/join", produces = "application/json")
284
    public ResponseEntity<String> joinCommon(
285
            @Parameter(name="commonsId") @RequestParam Long commonsId) throws Exception {
286
287
        User u = getCurrentUser().getUser();
288
        Long userId = u.getId();
289
        String username = u.getFullName();
290
291
        //if the commons is not found, throw a EntityNotFoundException
292
        //if the commons is hidden, throw a CommonsHiddenException
293
        Commons joinedCommons = commonsRepository.findById(commonsId)
294 1 1. lambda$joinCommon$2 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$joinCommon$2 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(Commons.class, commonsId));
295
            
296 1 1. joinCommon : negated conditional → KILLED
        if (joinedCommons.isHidden()) {
297
            throw new CommonsHiddenException("Commons with id " + commonsId + " is hidden and cannot be joined");
298
        }
299
300
        Optional<UserCommons> userCommonsLookup = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId);
301
302 1 1. joinCommon : negated conditional → KILLED
        if (userCommonsLookup.isPresent()) {
303
            // user is already a member of this commons
304
            String body = mapper.writeValueAsString(joinedCommons);
305 1 1. joinCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::joinCommon → KILLED
            return ResponseEntity.ok().body(body);
306
        }
307
308
        UserCommons uc = UserCommons.builder()
309
                .user(u)
310
                .commons(joinedCommons)
311
                .username(username)
312
                .totalWealth(joinedCommons.getStartingBalance())
313
                .numOfCows(0)
314
                .cowHealth(100)
315
                .cowsBought(0)
316
                .cowsSold(0)
317
                .cowDeaths(0)
318
                .build();
319
320
        userCommonsRepository.save(uc);
321
322
        String body = mapper.writeValueAsString(joinedCommons);
323 1 1. joinCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::joinCommon → KILLED
        return ResponseEntity.ok().body(body);
324
    }
325
326
    @Operation(summary = "Delete a Commons")
327
    @PreAuthorize("hasRole('ROLE_ADMIN')")
328
    @DeleteMapping("")
329
    public Object deleteCommons(
330
            @Parameter(name="id") @RequestParam Long id) {
331
        
332
        Iterable<UserCommons> userCommons = userCommonsRepository.findByCommonsId(id);
333
334
        for (UserCommons commons : userCommons) {
335 1 1. deleteCommons : removed call to edu/ucsb/cs156/happiercows/repositories/UserCommonsRepository::delete → KILLED
            userCommonsRepository.delete(commons);
336
        }
337
338
        commonsRepository.findById(id)
339 1 1. lambda$deleteCommons$3 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$deleteCommons$3 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(Commons.class, id));
340
341 1 1. deleteCommons : removed call to edu/ucsb/cs156/happiercows/repositories/CommonsRepository::deleteById → KILLED
        commonsRepository.deleteById(id);
342
343
        String responseString = String.format("commons with id %d deleted", id);
344 1 1. deleteCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::deleteCommons → KILLED
        return genericMessage(responseString);
345
346
    }
347
348
    @Operation(summary="Delete a user from a commons")
349
    @PreAuthorize("hasRole('ROLE_ADMIN')")
350
    @DeleteMapping("/{commonsId}/users/{userId}")
351
    public Object deleteUserFromCommon(@PathVariable("commonsId") Long commonsId,
352
                                       @PathVariable("userId") Long userId) throws Exception {
353
354
        UserCommons userCommons = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId)
355 1 1. lambda$deleteUserFromCommon$4 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$deleteUserFromCommon$4 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(
356
                        UserCommons.class, "commonsId", commonsId, "userId", userId)
357
                );
358
359 1 1. deleteUserFromCommon : removed call to edu/ucsb/cs156/happiercows/repositories/UserCommonsRepository::delete → KILLED
        userCommonsRepository.delete(userCommons);
360
361
        String responseString = String.format("user with id %d deleted from commons with id %d, %d users remain", userId, commonsId, commonsRepository.getNumUsers(commonsId).orElse(0));
362
363 1 1. deleteUserFromCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::deleteUserFromCommon → KILLED
        return genericMessage(responseString);
364
    }
365
366
    
367
}

Mutations

90

1.1
Location : getDefaultCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:getDefaultCommonsValuesTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getDefaultCommons → KILLED

99

1.1
Location : getCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:getCommonsTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommons → KILLED

113

1.1
Location : getCommonsPlus
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:getCommonsPlusTest()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsPlus → KILLED

122

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

124

1.1
Location : getCommonsPlusById
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:getCommonsPlusByIdTest_valid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsPlusById → KILLED

139

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

147

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setName → KILLED

148

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCowPrice → KILLED

149

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setMilkPrice → KILLED

150

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingBalance → KILLED

151

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingDate → KILLED

152

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setLastDate → KILLED

153

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowLeaderboard → KILLED

154

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowChat → KILLED

155

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setDegradationRate → KILLED

156

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCapacityPerUser → KILLED

157

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCarryingCapacity → KILLED

158

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

159

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setAboveCapacityHealthUpdateStrategy → KILLED

161

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

162

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setBelowCapacityHealthUpdateStrategy → KILLED

165

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

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

170

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

174

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

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

178

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

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

182

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

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

186

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

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

190

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_hiddenCanBeToggled()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setHidden → KILLED

193

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:UpdateCommonsTest_withBoundaryParameters()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::updateCommons → KILLED

203

1.1
Location : lambda$getCommonsById$1
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:getCommonsByIdTest_invalid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$getCommonsById$1 → KILLED

205

1.1
Location : getCommonsById
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:getCommonsByIdTest_valid()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsById → KILLED

230

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

233

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

240

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

244

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

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

248

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

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

252

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

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

257

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

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

261

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

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

268

1.1
Location : createCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:createCommonsTest_zeroDegradation()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::createCommons → KILLED

278

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

294

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

296

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

302

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

305

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

323

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

335

1.1
Location : deleteCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:deleteCommons_test_admin_exists()]
removed call to edu/ucsb/cs156/happiercows/repositories/UserCommonsRepository::delete → KILLED

339

1.1
Location : lambda$deleteCommons$3
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:deleteCommons_test_admin_nonexists()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$deleteCommons$3 → KILLED

341

1.1
Location : deleteCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:deleteCommons_test_admin_exists()]
removed call to edu/ucsb/cs156/happiercows/repositories/CommonsRepository::deleteById → KILLED

344

1.1
Location : deleteCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:deleteCommons_test_admin_exists()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::deleteCommons → KILLED

355

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

359

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

363

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

Active mutators

Tests examined


Report generated by PIT 1.17.0