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.repositories.ProfitRepository;
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 org.springframework.transaction.annotation.Transactional;
27
import edu.ucsb.cs156.happiercows.services.CommonsPlusBuilderService;
28
29
30
import java.util.Optional;
31
32
33
@Slf4j
34
@Tag(name = "Commons")
35
@RequestMapping("/api/commons")
36
@RestController
37
public class CommonsController extends ApiController {
38
    @Autowired
39
    private CommonsRepository commonsRepository;
40
41
    @Autowired
42
    private UserCommonsRepository userCommonsRepository;
43
44
    @Autowired
45
    private ProfitRepository profitRepository;
46
47
    @Autowired
48
    ObjectMapper mapper;
49
50
    @Autowired
51
    CommonsPlusBuilderService commonsPlusBuilderService;
52
53
    @Value("${app.commons.default.startingBalance}")
54
    private double defaultStartingBalance;
55
56
    @Value("${app.commons.default.cowPrice}")
57
    private double defaultCowPrice;
58
59
    @Value("${app.commons.default.milkPrice}")
60
    private double defaultMilkPrice;
61
62
    @Value("${app.commons.default.degradationRate}")
63
    private double defaultDegradationRate;
64
65
    @Value("${app.commons.default.carryingCapacity}")
66
    private int defaultCarryingCapacity;
67
68
    @Value("${app.commons.default.capacityPerUser}")
69
    private int defaultCapacityPerUser;
70
71
    @Value("${app.commons.default.aboveCapacityHealthUpdateStrategy}")
72
    private String defaultAboveCapacityHealthUpdateStrategy;
73
74
    @Value("${app.commons.default.belowCapacityHealthUpdateStrategy}")
75
    private String defaultBelowCapacityHealthUpdateStrategy;
76
77
    @Operation(summary = "Get default common values")
78
    @GetMapping("/defaults")
79
    public ResponseEntity<Commons> getDefaultCommons() throws JsonProcessingException {
80
        log.info("getDefaultCommons()...");
81
82
        Commons defaultCommons = Commons.builder()
83
                .startingBalance(defaultStartingBalance)
84
                .cowPrice(defaultCowPrice)
85
                .milkPrice(defaultMilkPrice)
86
                .degradationRate(defaultDegradationRate)
87
                .carryingCapacity(defaultCarryingCapacity)
88
                .capacityPerUser(defaultCapacityPerUser)
89
                .aboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(defaultAboveCapacityHealthUpdateStrategy))
90
                .belowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(defaultBelowCapacityHealthUpdateStrategy))
91
                .build();
92
93 1 1. getDefaultCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getDefaultCommons → KILLED
        return ResponseEntity.ok().body(defaultCommons);
94
    }
95
96
    @Operation(summary = "Get a list of all commons")
97
    @GetMapping("/all")
98
    public ResponseEntity<String> getCommons() throws JsonProcessingException {
99
        log.info("getCommons()...");
100
        Iterable<Commons> commons = commonsRepository.findAll();
101
        String body = mapper.writeValueAsString(commons);
102 1 1. getCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommons → KILLED
        return ResponseEntity.ok().body(body);
103
    }
104
105
    @Operation(summary = "Get a list of all commons and number of cows/users")
106
    @GetMapping("/allplus")
107
    public ResponseEntity<String> getCommonsPlus() throws JsonProcessingException {
108
        log.info("getCommonsPlus()...");
109
        Iterable<Commons> commonsListIter = commonsRepository.findAll();
110
111
        // convert Iterable to List for the purposes of using a Java Stream & lambda
112
        // below
113
        Iterable<CommonsPlus> commonsPlusList = commonsPlusBuilderService.convertToCommonsPlus(commonsListIter);
114
115
        String body = mapper.writeValueAsString(commonsPlusList);
116 1 1. getCommonsPlus : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsPlus → KILLED
        return ResponseEntity.ok().body(body);
117
    }
118
119
    @Operation(summary = "Get the number of cows/users in a commons")
120
    @PreAuthorize("hasRole('ROLE_USER')")
121
    @GetMapping("/plus")
122
    public CommonsPlus getCommonsPlusById(
123
            @Parameter(name="id") @RequestParam long id) throws JsonProcessingException {
124
                CommonsPlus commonsPlus = commonsPlusBuilderService.toCommonsPlus(commonsRepository.findById(id)
125 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)));
126
127 1 1. getCommonsPlusById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsPlusById → KILLED
        return commonsPlus;
128
    }
129
130
    @Operation(summary = "Update a commons")
131
    @PreAuthorize("hasRole('ROLE_ADMIN')")
132
    @PutMapping("/update")
133
    public ResponseEntity<String> updateCommons(
134
            @Parameter(name="id") @RequestParam long id,
135
            @Parameter(name="request body") @RequestBody CreateCommonsParams params
136
    ) {
137
        Optional<Commons> existing = commonsRepository.findById(id);
138
139
        Commons updated;
140
        HttpStatus status;
141
142 1 1. updateCommons : negated conditional → KILLED
        if (existing.isPresent()) {
143
            updated = existing.get();
144
            status = HttpStatus.NO_CONTENT;
145
        } else {
146
            updated = new Commons();
147
            status = HttpStatus.CREATED;
148
        }
149
150 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setName → KILLED
        updated.setName(params.getName());
151 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCowPrice → KILLED
        updated.setCowPrice(params.getCowPrice());
152 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setMilkPrice → KILLED
        updated.setMilkPrice(params.getMilkPrice());
153 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingBalance → KILLED
        updated.setStartingBalance(params.getStartingBalance());
154 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingDate → KILLED
        updated.setStartingDate(params.getStartingDate());
155 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setLastDate → KILLED
        updated.setLastDate(params.getLastDate());
156 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowLeaderboard → KILLED
        updated.setShowLeaderboard(params.getShowLeaderboard());
157 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setShowChat → KILLED
        updated.setShowChat(params.getShowChat());
158 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setDegradationRate → KILLED
        updated.setDegradationRate(params.getDegradationRate());
159 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCapacityPerUser → KILLED
        updated.setCapacityPerUser(params.getCapacityPerUser());
160 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCarryingCapacity → KILLED
        updated.setCarryingCapacity(params.getCarryingCapacity());
161 1 1. updateCommons : negated conditional → KILLED
        if (params.getAboveCapacityHealthUpdateStrategy() != null) {
162 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setAboveCapacityHealthUpdateStrategy → KILLED
            updated.setAboveCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getAboveCapacityHealthUpdateStrategy()));
163
        }
164 1 1. updateCommons : negated conditional → KILLED
        if (params.getBelowCapacityHealthUpdateStrategy() != null) {
165 1 1. updateCommons : removed call to edu/ucsb/cs156/happiercows/entities/Commons::setBelowCapacityHealthUpdateStrategy → KILLED
            updated.setBelowCapacityHealthUpdateStrategy(CowHealthUpdateStrategies.valueOf(params.getBelowCapacityHealthUpdateStrategy()));
166
        }
167
168 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getDegradationRate() < 0) {
169
            throw new IllegalArgumentException("Degradation Rate cannot be negative");
170
        }
171
172
        // Reference: frontend/src/main/components/Commons/CommonsForm.js
173 1 1. updateCommons : negated conditional → KILLED
        if (params.getName().equals("")) {
174
            throw new IllegalArgumentException("Name cannot be empty");
175
        }
176
177 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getCowPrice() < 0.01) {
178
            throw new IllegalArgumentException("Cow Price cannot be less than 0.01");
179
        }
180
181 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getMilkPrice() < 0.01) {
182
            throw new IllegalArgumentException("Milk Price cannot be less than 0.01");
183
        }
184
185 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getStartingBalance() < 0) {
186
            throw new IllegalArgumentException("Starting Balance cannot be negative");
187
        }
188
189 2 1. updateCommons : changed conditional boundary → KILLED
2. updateCommons : negated conditional → KILLED
        if (params.getCarryingCapacity() < 1) {
190
            throw new IllegalArgumentException("Carrying Capacity cannot be less than 1");
191
        }
192
        commonsRepository.save(updated);
193
194 1 1. updateCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::updateCommons → KILLED
        return ResponseEntity.status(status).build();
195
    }
196
197
    @Operation(summary = "Get a specific commons")
198
    @PreAuthorize("hasRole('ROLE_USER')")
199
    @GetMapping("")
200
    public Commons getCommonsById(
201
            @Parameter(name="id") @RequestParam Long id) throws JsonProcessingException {
202
203
        Commons commons = commonsRepository.findById(id)
204 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));
205
206 1 1. getCommonsById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::getCommonsById → KILLED
        return commons;
207
    }
208
209
    @Operation(summary = "Create a new commons")
210
    @PreAuthorize("hasRole('ROLE_ADMIN')")
211
    @PostMapping(value = "/new", produces = "application/json")
212
    public ResponseEntity<String> createCommons(
213
            @Parameter(name="request body") @RequestBody CreateCommonsParams params
214
    ) throws JsonProcessingException {
215
216
        var builder = Commons.builder()
217
                .name(params.getName())
218
                .cowPrice(params.getCowPrice())
219
                .milkPrice(params.getMilkPrice())
220
                .startingBalance(params.getStartingBalance())
221
                .startingDate(params.getStartingDate())
222
                .lastDate(params.getLastDate())
223
                .degradationRate(params.getDegradationRate())
224
                .showLeaderboard(params.getShowLeaderboard())
225
                .showChat(params.getShowChat())
226
                .capacityPerUser(params.getCapacityPerUser())
227
                .carryingCapacity(params.getCarryingCapacity());
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 : changed conditional boundary → KILLED
2. createCommons : negated conditional → 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 : changed conditional boundary → KILLED
2. createCommons : negated conditional → 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 : changed conditional boundary → KILLED
2. createCommons : negated conditional → KILLED
        if (params.getDegradationRate() < 0) {
258
            throw new IllegalArgumentException("Degradation Rate cannot be negative");
259
        }
260
261 2 1. createCommons : changed conditional boundary → KILLED
2. createCommons : negated conditional → 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
        Commons joinedCommons = commonsRepository.findById(commonsId)
292 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));
293
        Optional<UserCommons> userCommonsLookup = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId);
294
295 1 1. joinCommon : negated conditional → KILLED
        if (userCommonsLookup.isPresent()) {
296
            // user is already a member of this commons
297
            String body = mapper.writeValueAsString(joinedCommons);
298 1 1. joinCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::joinCommon → KILLED
            return ResponseEntity.ok().body(body);
299
        }
300
301
        UserCommons uc = UserCommons.builder()
302
                .user(u)
303
                .commons(joinedCommons)
304
                .username(username)
305
                .totalWealth(joinedCommons.getStartingBalance())
306
                .numOfCows(0)
307
                .cowHealth(100)
308
                .cowsBought(0)
309
                .cowsSold(0)
310
                .cowDeaths(0)
311
                .build();
312
313
        userCommonsRepository.save(uc);
314
315
        String body = mapper.writeValueAsString(joinedCommons);
316 1 1. joinCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::joinCommon → KILLED
        return ResponseEntity.ok().body(body);
317
    }
318
319
    @Operation(summary = "Delete a Commons")
320
    @PreAuthorize("hasRole('ROLE_ADMIN')")
321
    @DeleteMapping("")
322
    public Object deleteCommons(
323
            @Parameter(name="id") @RequestParam Long id) {
324
        
325
        Iterable<UserCommons> userCommons = userCommonsRepository.findByCommonsId(id);
326
327
        for (UserCommons commons : userCommons) {
328 1 1. deleteCommons : removed call to edu/ucsb/cs156/happiercows/repositories/UserCommonsRepository::delete → KILLED
            userCommonsRepository.delete(commons);
329
        }
330
331
        commonsRepository.findById(id)
332 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));
333
334 1 1. deleteCommons : removed call to edu/ucsb/cs156/happiercows/repositories/CommonsRepository::deleteById → KILLED
        commonsRepository.deleteById(id);
335
336
        String responseString = String.format("commons with id %d deleted", id);
337 1 1. deleteCommons : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::deleteCommons → KILLED
        return genericMessage(responseString);
338
339
    }
340
341
    @Operation(summary="Delete a user from a commons")
342
    @PreAuthorize("hasRole('ROLE_ADMIN')")
343
    @DeleteMapping("/{commonsId}/users/{userId}")
344
    @Transactional
345
    public Object deleteUserFromCommon(@PathVariable("commonsId") Long commonsId,
346
                                       @PathVariable("userId") Long userId) throws Exception {
347
348
        UserCommons userCommons = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId)
349 1 1. lambda$deleteUserFromCommon$4 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::lambda$deleteUserFromCommon$4 → KILLED
                .orElseThrow(() -> new EntityNotFoundException(
350
                        UserCommons.class, "commonsId", commonsId, "userId", userId)
351
                );
352
353 1 1. deleteUserFromCommon : removed call to edu/ucsb/cs156/happiercows/repositories/ProfitRepository::deleteByUserCommons → SURVIVED
        profitRepository.deleteByUserCommons(userCommons);
354
355 1 1. deleteUserFromCommon : removed call to edu/ucsb/cs156/happiercows/repositories/UserCommonsRepository::delete → KILLED
        userCommonsRepository.delete(userCommons);
356
357
        String responseString = String.format("user with id %d deleted from commons with id %d, %d users remain", userId, commonsId, commonsRepository.getNumUsers(commonsId).orElse(0));
358
359 1 1. deleteUserFromCommon : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CommonsController::deleteUserFromCommon → KILLED
        return genericMessage(responseString);
360
    }
361
362
    
363
}

Mutations

93

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

102

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

116

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

125

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

127

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

142

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withNoCowHealthUpdateStrategy()]
negated conditional → 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::setName → 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::setCowPrice → 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::setMilkPrice → 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::setStartingBalance → 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::setStartingDate → 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()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setLastDate → 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::setShowLeaderboard → 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::setShowChat → 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_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setDegradationRate → 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_withIllegalDegradationRate()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCapacityPerUser → KILLED

160

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

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_withNoCowHealthUpdateStrategy()]
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::setAboveCapacityHealthUpdateStrategy → KILLED

164

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

168

1.1
Location : updateCommons
Killed by : edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CommonsControllerTests]/[method:updateCommonsTest_withDegradationRate_Zero()]
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_withNoCowHealthUpdateStrategy()]
negated conditional → KILLED

173

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

177

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

181

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

185

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

189

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

194

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

204

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

206

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

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

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

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

292

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

295

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

298

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

316

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

328

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

332

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

334

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

337

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

349

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

353

1.1
Location : deleteUserFromCommon
Killed by : none
removed call to edu/ucsb/cs156/happiercows/repositories/ProfitRepository::deleteByUserCommons → SURVIVED

355

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

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