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

Mutations

81

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

82

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

85

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

95

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

109

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

118

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

120

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

135

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

143

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()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setName → KILLED

144

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()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setCowPrice → 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_withDegradationRate_Zero()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setMilkPrice → 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_withDegradationRate_Zero()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingBalance → 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_withDegradationRate_Zero()]
removed call to edu/ucsb/cs156/happiercows/entities/Commons::setStartingDate → KILLED

148

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

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

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

169

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

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

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

196

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

198

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

221

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

224

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

231

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

235

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

239

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

243

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

259

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

269

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

283

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

286

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

289

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

307

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

317

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

319

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

322

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

333

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

337

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

341

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