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

Mutations

88

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

97

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

111

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

120

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

122

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

137

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

145

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

146

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

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::setMilkPrice → 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::setStartingBalance → 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::setStartingDate → KILLED

150

1.1
Location : updateCommons
Killed by : none
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setLastDate → SURVIVED

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()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowLeaderboard → 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_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setDegradationRate → 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_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCapacityPerUser → 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::setCarryingCapacity → 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_withBoundaryParameters()]
negated conditional → 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()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setAboveCapacityHealthUpdateStrategy → 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::setBelowCapacityHealthUpdateStrategy → 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_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

167

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

171

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

175

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

179

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

183

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

188

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

198

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

200

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

223

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

226

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

237

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

241

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

245

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

250

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

254

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

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_zeroDegradation()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::createCommons → KILLED

271

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

285

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

288

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

291

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

309

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

319

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

321

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

324

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

335

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

339

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

343

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.7.3