|
1
|
|
package edu.ucsb.cs156.happiercows.controllers; |
|
2
|
|
|
|
3
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
4
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
5
|
|
|
|
6
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
7
|
|
|
|
8
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
9
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
10
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
11
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
12
|
|
import org.springframework.web.bind.annotation.RestController; |
|
13
|
|
|
|
14
|
|
import edu.ucsb.cs156.happiercows.repositories.FarmerRepository; |
|
15
|
|
import edu.ucsb.cs156.happiercows.repositories.GameRepository; |
|
16
|
|
import edu.ucsb.cs156.happiercows.repositories.HerdRepository; |
|
17
|
|
import edu.ucsb.cs156.happiercows.entities.User; |
|
18
|
|
import edu.ucsb.cs156.happiercows.entities.Farmer; |
|
19
|
|
import edu.ucsb.cs156.happiercows.entities.FarmerActivity; |
|
20
|
|
import edu.ucsb.cs156.happiercows.entities.Game; |
|
21
|
|
import edu.ucsb.cs156.happiercows.entities.Herd; |
|
22
|
|
import edu.ucsb.cs156.happiercows.errors.EntityNotFoundException; |
|
23
|
|
import edu.ucsb.cs156.happiercows.errors.InvalidNumberOfCowsException; |
|
24
|
|
import edu.ucsb.cs156.happiercows.errors.NoCowsException; |
|
25
|
|
import edu.ucsb.cs156.happiercows.errors.NotEnoughMoneyException; |
|
26
|
|
import edu.ucsb.cs156.happiercows.errors.GameHiddenException; |
|
27
|
|
import edu.ucsb.cs156.happiercows.errors.NotEnrolledInCourseAssociatedWithGameException; |
|
28
|
|
import edu.ucsb.cs156.happiercows.models.FarmerWithStudentStatus; |
|
29
|
|
import edu.ucsb.cs156.happiercows.services.CourseAccessService; |
|
30
|
|
import edu.ucsb.cs156.happiercows.services.FarmerActivityService; |
|
31
|
|
|
|
32
|
|
import java.util.ArrayList; |
|
33
|
|
import java.util.Collection; |
|
34
|
|
import java.util.HashMap; |
|
35
|
|
import java.util.Map; |
|
36
|
|
import java.util.List; |
|
37
|
|
|
|
38
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
39
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
40
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
41
|
|
|
|
42
|
|
import org.springframework.http.ResponseEntity; |
|
43
|
|
import org.springframework.web.bind.annotation.PutMapping; |
|
44
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
45
|
|
import org.springframework.transaction.annotation.Transactional; |
|
46
|
|
|
|
47
|
|
@Tag(name = "User Game") |
|
48
|
|
@RequestMapping("/api/farmer") |
|
49
|
|
@RestController |
|
50
|
|
public class FarmerController extends ApiController { |
|
51
|
|
|
|
52
|
|
@Autowired |
|
53
|
|
private FarmerRepository farmerRepository; |
|
54
|
|
|
|
55
|
|
@Autowired |
|
56
|
|
private GameRepository gameRepository; |
|
57
|
|
|
|
58
|
|
@Autowired |
|
59
|
|
private HerdRepository herdRepository; |
|
60
|
|
|
|
61
|
|
@Autowired |
|
62
|
|
ObjectMapper mapper; |
|
63
|
|
|
|
64
|
|
@Autowired |
|
65
|
|
private CourseAccessService courseAccessService; |
|
66
|
|
|
|
67
|
|
@Autowired |
|
68
|
|
private FarmerActivityService farmerActivityService; |
|
69
|
|
|
|
70
|
|
@Operation(summary = "Get a specific user game (admin only)") |
|
71
|
|
@PreAuthorize("hasRole('ROLE_ADMIN')") |
|
72
|
|
@GetMapping("") |
|
73
|
|
public Farmer getFarmerById( |
|
74
|
|
@Parameter(name="userId") @RequestParam Long userId, |
|
75
|
|
@Parameter(name="gameId") @RequestParam Long gameId) throws JsonProcessingException { |
|
76
|
|
|
|
77
|
|
Farmer farmer = farmerRepository.findByGameIdAndUserId(gameId, userId) |
|
78
|
|
.orElseThrow( |
|
79
|
1
1. lambda$getFarmerById$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmerById$0 → KILLED
|
() -> new EntityNotFoundException(Farmer.class, "gameId", gameId, "userId", userId)); |
|
80
|
1
1. getFarmerById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::getFarmerById → KILLED
|
return farmer; |
|
81
|
|
} |
|
82
|
|
|
|
83
|
|
@Operation(summary = "Get a user game for current user") |
|
84
|
|
@PreAuthorize("hasRole('ROLE_USER')") |
|
85
|
|
@GetMapping("/forcurrentuser") |
|
86
|
|
public Farmer getFarmerById( |
|
87
|
|
@Parameter(name="gameId") @RequestParam Long gameId) throws JsonProcessingException { |
|
88
|
|
|
|
89
|
|
User u = getCurrentUser().getUser(); |
|
90
|
|
Long userId = u.getId(); |
|
91
|
|
Game game = gameRepository.findById(gameId) |
|
92
|
1
1. lambda$getFarmerById$1 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmerById$1 → KILLED
|
.orElseThrow(() -> new EntityNotFoundException("Game", gameId)); |
|
93
|
1
1. getFarmerById : removed call to edu/ucsb/cs156/happiercows/controllers/FarmerController::ensureUserCanAccessCourseLinkedGame → KILLED
|
ensureUserCanAccessCourseLinkedGame(u, game); |
|
94
|
|
Farmer farmer = farmerRepository.findByGameIdAndUserId(gameId, userId) |
|
95
|
|
.orElseThrow( |
|
96
|
1
1. lambda$getFarmerById$2 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmerById$2 → KILLED
|
() -> new EntityNotFoundException(Farmer.class, "gameId", gameId, "userId", userId)); |
|
97
|
1
1. getFarmerById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::getFarmerById → KILLED
|
return farmer; |
|
98
|
|
} |
|
99
|
|
|
|
100
|
|
@Operation(summary = "Buy a herd of numCows cows (starting at 100 health), totalWealth updated") |
|
101
|
|
@PreAuthorize("hasRole('ROLE_USER')") |
|
102
|
|
@PutMapping("/buy") |
|
103
|
|
public ResponseEntity<String> putFarmerByIdBuy( |
|
104
|
|
@Parameter(name="gameId") @RequestParam Long gameId, |
|
105
|
|
@Parameter(name="numCows") @RequestParam int numCows) throws NotEnoughMoneyException, InvalidNumberOfCowsException, JsonProcessingException{ |
|
106
|
|
|
|
107
|
2
1. putFarmerByIdBuy : changed conditional boundary → KILLED
2. putFarmerByIdBuy : negated conditional → KILLED
|
if (numCows < 1) { |
|
108
|
|
throw new InvalidNumberOfCowsException("You must buy at least 1 cow!"); |
|
109
|
|
} |
|
110
|
|
|
|
111
|
|
User u = getCurrentUser().getUser(); |
|
112
|
|
Long userId = u.getId(); |
|
113
|
|
|
|
114
|
|
Game game = gameRepository.findById(gameId).orElseThrow( |
|
115
|
1
1. lambda$putFarmerByIdBuy$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdBuy$0 → KILLED
|
()->new EntityNotFoundException("Game", gameId)); |
|
116
|
|
|
|
117
|
1
1. putFarmerByIdBuy : removed call to edu/ucsb/cs156/happiercows/controllers/FarmerController::ensureUserCanAccessCourseLinkedGame → KILLED
|
ensureUserCanAccessCourseLinkedGame(u, game); |
|
118
|
|
|
|
119
|
1
1. putFarmerByIdBuy : negated conditional → KILLED
|
if (game.isHidden()) { |
|
120
|
|
throw new GameHiddenException(gameId); |
|
121
|
|
} |
|
122
|
|
|
|
123
|
|
Farmer farmer = farmerRepository.findByGameIdAndUserId(gameId, userId) |
|
124
|
|
.orElseThrow( |
|
125
|
1
1. lambda$putFarmerByIdBuy$1 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdBuy$1 → KILLED
|
() -> new EntityNotFoundException(Farmer.class, "gameId", gameId, "userId", userId)); |
|
126
|
|
|
|
127
|
1
1. putFarmerByIdBuy : Replaced double addition with subtraction → KILLED
|
double costPerCow = game.getCowPrice() + game.getPurchaseFee(); |
|
128
|
3
1. putFarmerByIdBuy : Replaced double multiplication with division → KILLED
2. putFarmerByIdBuy : negated conditional → KILLED
3. putFarmerByIdBuy : changed conditional boundary → KILLED
|
if(farmer.getTotalWealth() >= (costPerCow * numCows)){ |
|
129
|
3
1. putFarmerByIdBuy : Replaced double multiplication with division → KILLED
2. putFarmerByIdBuy : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setTotalWealth → KILLED
3. putFarmerByIdBuy : Replaced double subtraction with addition → KILLED
|
farmer.setTotalWealth(farmer.getTotalWealth() - (costPerCow * numCows)); |
|
130
|
2
1. putFarmerByIdBuy : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setNumOfCows → KILLED
2. putFarmerByIdBuy : Replaced integer addition with subtraction → KILLED
|
farmer.setNumOfCows(farmer.getNumOfCows() + numCows); |
|
131
|
2
1. putFarmerByIdBuy : Replaced integer addition with subtraction → KILLED
2. putFarmerByIdBuy : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowsBought → KILLED
|
farmer.setCowsBought(farmer.getCowsBought() + numCows); |
|
132
|
|
} |
|
133
|
|
else{ |
|
134
|
|
throw new NotEnoughMoneyException("You need more money!"); |
|
135
|
|
} |
|
136
|
1
1. putFarmerByIdBuy : Replaced integer addition with subtraction → KILLED
|
int herdNumber = herdRepository.findMaxHerdNumber(gameId, userId) + 1; |
|
137
|
|
Herd newHerd = Herd.builder().farmer(farmer).herdNumber(herdNumber).numCows(numCows).health(100).build(); |
|
138
|
|
List<Herd> herds = new ArrayList<>(); |
|
139
|
1
1. putFarmerByIdBuy : removed call to java/lang/Iterable::forEach → KILLED
|
herdRepository.findByGameIdAndUserId(gameId, userId).forEach(herds::add); |
|
140
|
|
herds.add(newHerd); |
|
141
|
1
1. putFarmerByIdBuy : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowHealth → KILLED
|
farmer.setCowHealth(averageHealth(herds)); |
|
142
|
|
farmerRepository.save(farmer); |
|
143
|
|
herdRepository.save(newHerd); |
|
144
|
|
|
|
145
|
1
1. putFarmerByIdBuy : removed call to edu/ucsb/cs156/happiercows/services/FarmerActivityService::recordActivityIfStudentMatch → KILLED
|
farmerActivityService.recordActivityIfStudentMatch( |
|
146
|
|
u, game, farmer, FarmerActivity.ACTIVITY_TYPE_BUY, numCows); |
|
147
|
|
|
|
148
|
|
String body = mapper.writeValueAsString(farmer); |
|
149
|
1
1. putFarmerByIdBuy : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::putFarmerByIdBuy → KILLED
|
return ResponseEntity.ok().body(body); |
|
150
|
|
} |
|
151
|
|
|
|
152
|
|
/** |
|
153
|
|
* Sells cows from specific herds. The request body maps each herd id to the |
|
154
|
|
* number of cows to sell from that herd, e.g. {"12": 3, "15": 1}. Every herd |
|
155
|
|
* must belong to the current user in this game, and each count must be |
|
156
|
|
* between 0 and the number of cows in that herd. Each cow sells for the cow |
|
157
|
|
* price times its herd's health (as a percentage), minus the selling fee. |
|
158
|
|
* Herds that reach 0 cows are removed. |
|
159
|
|
*/ |
|
160
|
|
@Operation(summary = "Sell cows from specific herds, totalWealth updated") |
|
161
|
|
@PreAuthorize("hasRole('ROLE_USER')") |
|
162
|
|
@PutMapping("/sell") |
|
163
|
|
@Transactional |
|
164
|
|
public ResponseEntity<String> putFarmerByIdSell( |
|
165
|
|
@Parameter(name="gameId") @RequestParam Long gameId, |
|
166
|
|
@RequestBody Map<Long, Integer> herdCounts) throws NoCowsException, InvalidNumberOfCowsException, JsonProcessingException { |
|
167
|
|
User u = getCurrentUser().getUser(); |
|
168
|
|
Long userId = u.getId(); |
|
169
|
|
|
|
170
|
|
Game game = gameRepository.findById(gameId).orElseThrow( |
|
171
|
1
1. lambda$putFarmerByIdSell$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdSell$0 → KILLED
|
()->new EntityNotFoundException("Game", gameId)); |
|
172
|
|
|
|
173
|
1
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/controllers/FarmerController::ensureUserCanAccessCourseLinkedGame → KILLED
|
ensureUserCanAccessCourseLinkedGame(u, game); |
|
174
|
|
|
|
175
|
1
1. putFarmerByIdSell : negated conditional → KILLED
|
if (game.isHidden()) { |
|
176
|
|
throw new GameHiddenException(gameId); |
|
177
|
|
} |
|
178
|
|
|
|
179
|
|
Farmer farmer = farmerRepository.findByGameIdAndUserId(gameId, userId) |
|
180
|
|
.orElseThrow( |
|
181
|
1
1. lambda$putFarmerByIdSell$1 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdSell$1 → KILLED
|
() -> new EntityNotFoundException(Farmer.class, "gameId", gameId, "userId", userId)); |
|
182
|
|
|
|
183
|
|
// Only the current user's herds in this game can be sold from. |
|
184
|
|
Map<Long, Herd> herdsById = new HashMap<>(); |
|
185
|
|
for (Herd herd : herdRepository.findByGameIdAndUserId(gameId, userId)) { |
|
186
|
|
herdsById.put(herd.getId(), herd); |
|
187
|
|
} |
|
188
|
|
|
|
189
|
|
// Validate every requested count before changing anything. |
|
190
|
|
int totalCows = 0; |
|
191
|
|
double totalValue = 0; |
|
192
|
|
for (Map.Entry<Long, Integer> entry : herdCounts.entrySet()) { |
|
193
|
|
Herd herd = herdsById.get(entry.getKey()); |
|
194
|
1
1. putFarmerByIdSell : negated conditional → KILLED
|
if (herd == null) { |
|
195
|
|
throw new EntityNotFoundException(Herd.class, entry.getKey()); |
|
196
|
|
} |
|
197
|
|
Integer count = entry.getValue(); |
|
198
|
3
1. putFarmerByIdSell : negated conditional → KILLED
2. putFarmerByIdSell : negated conditional → KILLED
3. putFarmerByIdSell : changed conditional boundary → KILLED
|
if (count == null || count < 0) { |
|
199
|
|
throw new InvalidNumberOfCowsException("You cannot sell a negative number of cows!"); |
|
200
|
|
} |
|
201
|
2
1. putFarmerByIdSell : negated conditional → KILLED
2. putFarmerByIdSell : changed conditional boundary → KILLED
|
if (count > herd.getNumCows()) { |
|
202
|
|
throw new NoCowsException("You do not have enough cows in that herd to sell!"); |
|
203
|
|
} |
|
204
|
2
1. putFarmerByIdSell : Replaced double division with multiplication → KILLED
2. putFarmerByIdSell : Replaced double multiplication with division → KILLED
|
double cowValue = game.getCowPrice() * herd.getHealth() / 100 |
|
205
|
1
1. putFarmerByIdSell : Replaced double subtraction with addition → KILLED
|
- game.getSellingFee(); |
|
206
|
1
1. putFarmerByIdSell : Replaced integer addition with subtraction → KILLED
|
totalCows += count; |
|
207
|
2
1. putFarmerByIdSell : Replaced double addition with subtraction → KILLED
2. putFarmerByIdSell : Replaced double multiplication with division → KILLED
|
totalValue += cowValue * count; |
|
208
|
|
} |
|
209
|
2
1. putFarmerByIdSell : changed conditional boundary → KILLED
2. putFarmerByIdSell : negated conditional → KILLED
|
if (totalCows < 1) { |
|
210
|
|
throw new InvalidNumberOfCowsException("You must sell at least 1 cow!"); |
|
211
|
|
} |
|
212
|
|
|
|
213
|
|
for (Map.Entry<Long, Integer> entry : herdCounts.entrySet()) { |
|
214
|
|
Herd herd = herdsById.get(entry.getKey()); |
|
215
|
1
1. putFarmerByIdSell : Replaced integer subtraction with addition → KILLED
|
int remaining = herd.getNumCows() - entry.getValue(); |
|
216
|
1
1. putFarmerByIdSell : negated conditional → KILLED
|
if (remaining == 0) { |
|
217
|
1
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/repositories/HerdRepository::delete → KILLED
|
herdRepository.delete(herd); |
|
218
|
|
herdsById.remove(herd.getId()); |
|
219
|
2
1. putFarmerByIdSell : negated conditional → KILLED
2. putFarmerByIdSell : changed conditional boundary → KILLED
|
} else if (remaining < herd.getNumCows()) { |
|
220
|
1
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/entities/Herd::setNumCows → KILLED
|
herd.setNumCows(remaining); |
|
221
|
|
herdRepository.save(herd); |
|
222
|
|
} |
|
223
|
|
} |
|
224
|
|
|
|
225
|
2
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setTotalWealth → KILLED
2. putFarmerByIdSell : Replaced double addition with subtraction → KILLED
|
farmer.setTotalWealth(farmer.getTotalWealth() + totalValue); |
|
226
|
2
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setNumOfCows → KILLED
2. putFarmerByIdSell : Replaced integer subtraction with addition → KILLED
|
farmer.setNumOfCows(farmer.getNumOfCows() - totalCows); |
|
227
|
2
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowsSold → KILLED
2. putFarmerByIdSell : Replaced integer addition with subtraction → KILLED
|
farmer.setCowsSold(farmer.getCowsSold() + totalCows); |
|
228
|
1
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowHealth → KILLED
|
farmer.setCowHealth(averageHealth(herdsById.values())); |
|
229
|
|
farmerRepository.save(farmer); |
|
230
|
|
|
|
231
|
1
1. putFarmerByIdSell : removed call to edu/ucsb/cs156/happiercows/services/FarmerActivityService::recordActivityIfStudentMatch → KILLED
|
farmerActivityService.recordActivityIfStudentMatch( |
|
232
|
|
u, game, farmer, FarmerActivity.ACTIVITY_TYPE_SELL, totalCows); |
|
233
|
|
|
|
234
|
|
String body = mapper.writeValueAsString(farmer); |
|
235
|
1
1. putFarmerByIdSell : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::putFarmerByIdSell → KILLED
|
return ResponseEntity.ok().body(body); |
|
236
|
|
} |
|
237
|
|
|
|
238
|
|
|
|
239
|
|
|
|
240
|
|
/** |
|
241
|
|
* The farmer's cow health shown in Farm Stats: the average health of their |
|
242
|
|
* herds, weighted by the number of cows in each herd. A farmer with no |
|
243
|
|
* cows has health 100, matching the daily health update. |
|
244
|
|
*/ |
|
245
|
|
static double averageHealth(Collection<Herd> herds) { |
|
246
|
|
int cows = 0; |
|
247
|
|
double totalHealth = 0; |
|
248
|
|
for (Herd herd : herds) { |
|
249
|
1
1. averageHealth : Replaced integer addition with subtraction → KILLED
|
cows += herd.getNumCows(); |
|
250
|
2
1. averageHealth : Replaced double addition with subtraction → KILLED
2. averageHealth : Replaced double multiplication with division → KILLED
|
totalHealth += herd.getHealth() * herd.getNumCows(); |
|
251
|
|
} |
|
252
|
4
1. averageHealth : changed conditional boundary → KILLED
2. averageHealth : Replaced double division with multiplication → KILLED
3. averageHealth : negated conditional → KILLED
4. averageHealth : replaced double return with 0.0d for edu/ucsb/cs156/happiercows/controllers/FarmerController::averageHealth → KILLED
|
return cows > 0 ? totalHealth / cows : 100.0; |
|
253
|
|
} |
|
254
|
|
|
|
255
|
|
@Operation(summary = "Get all user game for a specific game") |
|
256
|
|
@PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')") |
|
257
|
|
@GetMapping("/game/all") |
|
258
|
|
public List<FarmerWithStudentStatus> getFarmersByGameId( |
|
259
|
|
@Parameter(name="gameId") @RequestParam Long gameId) { |
|
260
|
|
|
|
261
|
|
Game game = gameRepository.findById(gameId) |
|
262
|
1
1. lambda$getFarmersByGameId$0 : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmersByGameId$0 → KILLED
|
.orElseThrow(() -> new EntityNotFoundException("Game", gameId)); |
|
263
|
|
|
|
264
|
|
List<FarmerWithStudentStatus> result = new ArrayList<>(); |
|
265
|
|
for (Farmer farmer : farmerRepository.findByGameId(gameId)) { |
|
266
|
|
boolean isStudent = courseAccessService |
|
267
|
|
.findMatchingStudentForCourseLinkedGame(farmer.getUser(), game) |
|
268
|
|
.isPresent(); |
|
269
|
|
|
|
270
|
|
result.add(FarmerWithStudentStatus.builder() |
|
271
|
|
.userId(farmer.getUserId()) |
|
272
|
|
.gameId(farmer.getGameId()) |
|
273
|
|
.username(farmer.getUsername()) |
|
274
|
|
.totalWealth(farmer.getTotalWealth()) |
|
275
|
|
.numOfCows(farmer.getNumOfCows()) |
|
276
|
|
.cowHealth(farmer.getCowHealth()) |
|
277
|
|
.cowsBought(farmer.getCowsBought()) |
|
278
|
|
.cowsSold(farmer.getCowsSold()) |
|
279
|
|
.cowDeaths(farmer.getCowDeaths()) |
|
280
|
|
.student(isStudent) |
|
281
|
|
.build()); |
|
282
|
|
} |
|
283
|
1
1. getFarmersByGameId : replaced return value with Collections.emptyList for edu/ucsb/cs156/happiercows/controllers/FarmerController::getFarmersByGameId → KILLED
|
return result; |
|
284
|
|
} |
|
285
|
|
|
|
286
|
|
private void ensureUserCanAccessCourseLinkedGame(User user, Game game) { |
|
287
|
2
1. ensureUserCanAccessCourseLinkedGame : negated conditional → KILLED
2. ensureUserCanAccessCourseLinkedGame : negated conditional → KILLED
|
if (game.getCourseId() != null && !courseAccessService.isEligibleForGame(user, game)) { |
|
288
|
|
throw new NotEnrolledInCourseAssociatedWithGameException(); |
|
289
|
|
} |
|
290
|
|
} |
|
291
|
|
|
|
292
|
|
} |
| | Mutations |
| 79 |
|
1.1 Location : lambda$getFarmerById$0 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getFarmerById_nonexists_admin()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmerById$0 → KILLED
|
| 80 |
|
1.1 Location : getFarmerById Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getFarmerById_exists_admin()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::getFarmerById → KILLED
|
| 92 |
|
1.1 Location : lambda$getFarmerById$1 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getFarmerById_when_game_does_not_exist()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmerById$1 → KILLED
|
| 93 |
|
1.1 Location : getFarmerById Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getFarmerById_course_linked_game_requires_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/controllers/FarmerController::ensureUserCanAccessCourseLinkedGame → KILLED
|
| 96 |
|
1.1 Location : lambda$getFarmerById$2 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getFarmerById_nonexists()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmerById$2 → KILLED
|
| 97 |
|
1.1 Location : getFarmerById Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getFarmerById_exists()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::getFarmerById → KILLED
|
| 107 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_hidden_game()] changed conditional boundary → KILLED
2.2 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_negative_cows_rejected()] negated conditional → KILLED
|
| 115 |
|
1.1 Location : lambda$putFarmerByIdBuy$0 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_game_does_not_exist()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdBuy$0 → KILLED
|
| 117 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_course_linked_game_requires_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/controllers/FarmerController::ensureUserCanAccessCourseLinkedGame → KILLED
|
| 119 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_for_user_not_in_game()] negated conditional → KILLED
|
| 125 |
|
1.1 Location : lambda$putFarmerByIdBuy$1 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_for_user_not_in_game()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdBuy$1 → KILLED
|
| 127 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced double addition with subtraction → KILLED
|
| 128 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_not_enough_money()] Replaced double multiplication with division → KILLED
2.2 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_game_exists_not_enough_money()] negated conditional → KILLED
3.3 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_game_exists_user_has_exact_amount_needed()] changed conditional boundary → KILLED
|
| 129 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced double multiplication with division → KILLED
2.2 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setTotalWealth → KILLED
3.3 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced double subtraction with addition → KILLED
|
| 130 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setNumOfCows → KILLED
2.2 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced integer addition with subtraction → KILLED
|
| 131 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced integer addition with subtraction → KILLED
2.2 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowsBought → KILLED
|
| 136 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_updates_farm_health_to_weighted_average_of_herds()] Replaced integer addition with subtraction → KILLED
|
| 139 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_updates_farm_health_to_weighted_average_of_herds()] removed call to java/lang/Iterable::forEach → KILLED
|
| 141 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_updates_farm_health_to_weighted_average_of_herds()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowHealth → KILLED
|
| 145 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_game_exists()] removed call to edu/ucsb/cs156/happiercows/services/FarmerActivityService::recordActivityIfStudentMatch → KILLED
|
| 149 |
|
1.1 Location : putFarmerByIdBuy Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::putFarmerByIdBuy → KILLED
|
| 171 |
|
1.1 Location : lambda$putFarmerByIdSell$0 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_game_does_not_exist()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdSell$0 → KILLED
|
| 173 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/controllers/FarmerController::ensureUserCanAccessCourseLinkedGame → KILLED
|
| 175 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_for_user_not_in_game()] negated conditional → KILLED
|
| 181 |
|
1.1 Location : lambda$putFarmerByIdSell$1 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_for_user_not_in_game()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$putFarmerByIdSell$1 → KILLED
|
| 194 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_herd_not_owned_by_user_rejected()] negated conditional → KILLED
|
| 198 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_negative_count_rejected()] negated conditional → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_missing_count_rejected()] negated conditional → KILLED
3.3 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_zero_total_rejected()] changed conditional boundary → KILLED
|
| 201 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_zero_total_rejected()] negated conditional → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] changed conditional boundary → KILLED
|
| 204 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced double division with multiplication → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced double multiplication with division → KILLED
|
| 205 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_from_several_herds_uses_each_herds_health()] Replaced double subtraction with addition → KILLED
|
| 206 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced integer addition with subtraction → KILLED
|
| 207 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced double addition with subtraction → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced double multiplication with division → KILLED
|
| 209 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_herd_with_zero_requested_is_left_unchanged()] changed conditional boundary → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_empty_request_rejected()] negated conditional → KILLED
|
| 215 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced integer subtraction with addition → KILLED
|
| 216 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] negated conditional → KILLED
|
| 217 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/repositories/HerdRepository::delete → KILLED
|
| 219 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_herd_with_zero_requested_is_left_unchanged()] negated conditional → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_herd_with_zero_requested_is_left_unchanged()] changed conditional boundary → KILLED
|
| 220 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_herd_with_zero_requested_is_left_unchanged()] removed call to edu/ucsb/cs156/happiercows/entities/Herd::setNumCows → KILLED
|
| 225 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setTotalWealth → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced double addition with subtraction → KILLED
|
| 226 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setNumOfCows → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced integer subtraction with addition → KILLED
|
| 227 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowsSold → KILLED
2.2 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] Replaced integer addition with subtraction → KILLED
|
| 228 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] removed call to edu/ucsb/cs156/happiercows/entities/Farmer::setCowHealth → KILLED
|
| 231 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_from_several_herds_uses_each_herds_health()] removed call to edu/ucsb/cs156/happiercows/services/FarmerActivityService::recordActivityIfStudentMatch → KILLED
|
| 235 |
|
1.1 Location : putFarmerByIdSell Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_sellCows_course_linked_game_allows_current_enrollment()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::putFarmerByIdSell → KILLED
|
| 249 |
|
1.1 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_BuyCow_updates_farm_health_to_weighted_average_of_herds()] Replaced integer addition with subtraction → KILLED
|
| 250 |
|
1.1 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced double addition with subtraction → KILLED
2.2 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced double multiplication with division → KILLED
|
| 252 |
|
1.1 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_averageHealth_with_no_herds_is_100()] changed conditional boundary → KILLED
2.2 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_chargesPurchaseFeePerCow()] Replaced double division with multiplication → KILLED
3.3 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_averageHealth_with_no_herds_is_100()] negated conditional → KILLED
4.4 Location : averageHealth Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_averageHealth_with_no_herds_is_100()] replaced double return with 0.0d for edu/ucsb/cs156/happiercows/controllers/FarmerController::averageHealth → KILLED
|
| 262 |
|
1.1 Location : lambda$getFarmersByGameId$0 Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getAllFarmerById_game_does_not_exist()] replaced return value with null for edu/ucsb/cs156/happiercows/controllers/FarmerController::lambda$getFarmersByGameId$0 → KILLED
|
| 283 |
|
1.1 Location : getFarmersByGameId Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_getAllFarmerById_exists()] replaced return value with Collections.emptyList for edu/ucsb/cs156/happiercows/controllers/FarmerController::getFarmersByGameId → KILLED
|
| 287 |
|
1.1 Location : ensureUserCanAccessCourseLinkedGame Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_course_linked_game_requires_current_enrollment()] negated conditional → KILLED
2.2 Location : ensureUserCanAccessCourseLinkedGame Killed by : edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.FarmerControllerTests]/[method:test_buyCow_for_user_not_in_game()] negated conditional → KILLED
|