AnnouncementsController.java

1
package edu.ucsb.cs156.happiercows.controllers;
2
3
import com.fasterxml.jackson.databind.ObjectMapper;
4
import io.swagger.v3.oas.annotations.tags.Tag;
5
import lombok.extern.slf4j.Slf4j;
6
import io.swagger.v3.oas.annotations.Operation;
7
import io.swagger.v3.oas.annotations.Parameter;
8
import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.http.HttpStatus;
10
import org.springframework.http.ResponseEntity;
11
import org.springframework.security.access.prepost.PreAuthorize;
12
import org.springframework.security.core.context.SecurityContextHolder;
13
import org.springframework.web.bind.annotation.*;
14
import org.springframework.data.domain.Page;
15
import org.springframework.data.domain.PageRequest;
16
import org.springframework.data.domain.Sort;
17
18
import edu.ucsb.cs156.happiercows.entities.Announcement;
19
import edu.ucsb.cs156.happiercows.repositories.AnnouncementRepository;
20
21
import edu.ucsb.cs156.happiercows.entities.User;
22
import edu.ucsb.cs156.happiercows.entities.UserCommons;
23
import edu.ucsb.cs156.happiercows.repositories.UserCommonsRepository;
24
25
import org.springframework.security.core.Authentication;
26
import java.util.Date;
27
28
29
import java.util.Optional;
30
31
@Tag(name = "Announcements")
32
@RequestMapping("/api/announcements")
33
@RestController
34
@Slf4j
35
public class AnnouncementsController extends ApiController{
36
37
    @Autowired
38
    private AnnouncementRepository announcementRepository;
39
40
    @Autowired
41
    private UserCommonsRepository userCommonsRepository;
42
43
    @Autowired
44
    ObjectMapper mapper;
45
46
47
    @Operation(summary = "Create an announcement", description = "Create an announcement associated with a specific commons")
48
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
49
    @PostMapping("/post")
50
    public ResponseEntity<Object> createAnnouncement(
51
        @Parameter(description = "The id of the common") @RequestParam Long commonsId,
52
        @Parameter(description = "The datetime at which the announcement will be shown (defaults to current time)") @RequestParam(required = false) Date startDate,
53
        @Parameter(description = "The datetime at which the announcement will stop being shown (optional)") @RequestParam(required = false) Date endDate,
54
        @Parameter(description = "The announcement to be sent out") @RequestParam String announcementText) {
55
56
        User user = getCurrentUser().getUser();
57
        Long userId = user.getId();
58
59
        // Make sure the user is part of the commons or is an admin
60
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
61 3 1. createAnnouncement : negated conditional → KILLED
2. lambda$createAnnouncement$0 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$createAnnouncement$0 → KILLED
3. lambda$createAnnouncement$0 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$createAnnouncement$0 → KILLED
        if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
62
            log.info("User is not an admin");
63
            Optional<UserCommons> userCommonsLookup = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId);
64
65 1 1. createAnnouncement : negated conditional → KILLED
            if (!userCommonsLookup.isPresent()) {
66 1 1. createAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED
                return ResponseEntity.badRequest().body("Commons_id must exist.");
67
            }
68
        }
69
70 1 1. createAnnouncement : negated conditional → KILLED
        if (startDate == null) { 
71
            log.info("Start date not specified. Defaulting to current date.");
72
            startDate = new Date(); 
73
        }
74
75 1 1. createAnnouncement : negated conditional → KILLED
        if (announcementText == "") {
76 1 1. createAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED
            return ResponseEntity.badRequest().body("Announcement cannot be empty.");
77
        }
78 2 1. createAnnouncement : negated conditional → KILLED
2. createAnnouncement : negated conditional → KILLED
        if (endDate != null && startDate.after(endDate)) {
79 1 1. createAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED
            return ResponseEntity.badRequest().body("Start date must be before end date.");
80
        }
81
82
        // Create the announcement
83
        Announcement announcementObj = Announcement.builder()
84
        .commonsId(commonsId)
85
        .startDate(startDate)
86
        .endDate(endDate)
87
        .announcementText(announcementText)
88
        .build();
89
90
        // Save the announcement
91
        announcementRepository.save(announcementObj);
92
93 1 1. createAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED
        return ResponseEntity.ok(announcementObj);
94
    }
95
96
    @Operation(summary = "Get all announcements", description = "Get all announcements associated with a specific commons.")
97
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
98
    @GetMapping("/getbycommonsid")
99
    public ResponseEntity<Object> getAnnouncements(@Parameter(description = "The id of the common") @RequestParam Long commonsId) {
100
101
        // Make sure the user is part of the commons or is an admin
102
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
103 3 1. getAnnouncements : negated conditional → KILLED
2. lambda$getAnnouncements$1 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$getAnnouncements$1 → KILLED
3. lambda$getAnnouncements$1 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$getAnnouncements$1 → KILLED
        if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
104
            log.info("User is not an admin");
105
            User user = getCurrentUser().getUser();
106
            Long userId = user.getId();
107
            Optional<UserCommons> userCommonsLookup = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId);
108
109 1 1. getAnnouncements : negated conditional → KILLED
            if (!userCommonsLookup.isPresent()) {
110 1 1. getAnnouncements : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncements → KILLED
                return ResponseEntity.badRequest().body("Commons_id must exist.");
111
            }
112
        }
113
114
        int MAX_ANNOUNCEMENTS = 1000;
115
        Page<Announcement> announcements = announcementRepository.findByCommonsId(commonsId, PageRequest.of(0, MAX_ANNOUNCEMENTS, Sort.by("startDate").descending()));
116 1 1. getAnnouncements : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncements → KILLED
        return ResponseEntity.ok(announcements);
117
    }
118
119
    @Operation(summary = "Get announcements by id", description = "Get announcement by its id.")
120
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
121
    @GetMapping("/getbyid")
122
    public ResponseEntity<Object> getAnnouncementById(@Parameter(description = "The id of the announcement") @RequestParam Long id) {
123
124
        Optional<Announcement> announcementLookup = announcementRepository.findByAnnouncementId(id);
125 1 1. getAnnouncementById : negated conditional → KILLED
        if (!announcementLookup.isPresent()) {
126 1 1. getAnnouncementById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncementById → KILLED
            return ResponseEntity.badRequest().body("Cannot find announcement. id is invalid.");
127
128
        }
129 1 1. getAnnouncementById : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncementById → KILLED
        return ResponseEntity.ok(announcementLookup.get());
130
    }
131
132
    @Operation(summary = "Edit an announcement", description = "Edit an announcement by its id.")
133
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
134
    @PutMapping("/put")
135
    public ResponseEntity<Object> editAnnouncement(
136
        @Parameter(description = "The id of the announcement") @RequestParam Long id,
137
        @Parameter(description = "The id of the common") @RequestParam Long commonsId,
138
        @Parameter(description = "The datetime at which the announcement will be shown (defaults to current time)") @RequestParam(required = false) Date startDate,
139
        @Parameter(description = "The datetime at which the announcement will stop being shown (optional)") @RequestParam(required = false) Date endDate,
140
        @Parameter(description = "The announcement to be sent out") @RequestParam String announcementText) {
141
142
        User user = getCurrentUser().getUser();
143
        Long userId = user.getId();
144
145
        // Make sure the user is part of the commons or is an admin
146
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
147 3 1. editAnnouncement : negated conditional → KILLED
2. lambda$editAnnouncement$2 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$editAnnouncement$2 → KILLED
3. lambda$editAnnouncement$2 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$editAnnouncement$2 → KILLED
        if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
148
            log.info("User is not an admin");
149
            Optional<UserCommons> userCommonsLookup = userCommonsRepository.findByCommonsIdAndUserId(commonsId, userId);
150
151 1 1. editAnnouncement : negated conditional → KILLED
            if (!userCommonsLookup.isPresent()) {
152 1 1. editAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED
                return ResponseEntity.badRequest().body("Commons_id must exist.");
153
            }
154
        }
155
156 1 1. editAnnouncement : negated conditional → KILLED
        if (announcementText == "") {
157 1 1. editAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED
            return ResponseEntity.badRequest().body("Announcement cannot be empty.");
158
        }
159
160 1 1. editAnnouncement : negated conditional → KILLED
        if (startDate == null) {
161
            log.info("Start date not specified. Defaulting to current date.");
162
            startDate = new Date();
163
        }
164
165 2 1. editAnnouncement : negated conditional → KILLED
2. editAnnouncement : negated conditional → KILLED
        if (endDate != null && startDate.after(endDate)) {
166 1 1. editAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED
            return ResponseEntity.badRequest().body("Start date must be before end date.");
167
        }
168
169
        Optional<Announcement> announcementLookup = announcementRepository.findByAnnouncementId(id);
170
171 1 1. editAnnouncement : negated conditional → KILLED
        if (!announcementLookup.isPresent()) {
172 1 1. editAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED
            return ResponseEntity.badRequest().body("Announcement could not be found. Invalid id.");
173
        }
174
175
        // Create the announcement
176
        Announcement announcementObj = announcementLookup.get();
177 1 1. editAnnouncement : removed call to edu/ucsb/cs156/happiercows/entities/Announcement::setStartDate → KILLED
        announcementObj.setStartDate(startDate);
178 1 1. editAnnouncement : removed call to edu/ucsb/cs156/happiercows/entities/Announcement::setEndDate → KILLED
        announcementObj.setEndDate(endDate);
179 1 1. editAnnouncement : removed call to edu/ucsb/cs156/happiercows/entities/Announcement::setAnnouncementText → KILLED
        announcementObj.setAnnouncementText(announcementText);
180
181
        // Save the announcement
182
        announcementRepository.save(announcementObj);
183 1 1. editAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED
        return ResponseEntity.ok(announcementObj);
184
    }
185
186
187
    @Operation(summary = "Delete an announcement", description = "Delete an announcement associated with an id")
188
    @PreAuthorize("hasAnyRole('ROLE_ADMIN')")
189
    @DeleteMapping("/delete")
190
    public ResponseEntity<Object> deleteAnnouncement(@Parameter(description = "The id of the chat message") @RequestParam Long id) {
191
192
        // Try to get the chat message
193
        Optional<Announcement> announcementLookup = announcementRepository.findByAnnouncementId(id);
194 1 1. deleteAnnouncement : negated conditional → KILLED
        if (!announcementLookup.isPresent()) {
195 1 1. deleteAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::deleteAnnouncement → KILLED
            return ResponseEntity.badRequest().body("Cannot find announcement. id is invalid.");
196
        }
197
        Announcement announcementObj = announcementLookup.get();
198
199
        User user = getCurrentUser().getUser();
200
        Long userId = user.getId();
201
202
        // Hide the message
203 1 1. deleteAnnouncement : removed call to edu/ucsb/cs156/happiercows/repositories/AnnouncementRepository::delete → KILLED
        announcementRepository.delete(announcementObj);
204 1 1. deleteAnnouncement : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::deleteAnnouncement → KILLED
        return ResponseEntity.ok(announcementObj);
205
    }
206
207
208
}

Mutations

61

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

2.2
Location : lambda$createAnnouncement$0
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanPostAnnouncements()]
replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$createAnnouncement$0 → KILLED

3.3
Location : lambda$createAnnouncement$0
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userNotInCommonsCannotPostAnnouncements()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$createAnnouncement$0 → KILLED

65

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

66

1.1
Location : createAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userNotInCommonsCannotPostAnnouncements()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED

70

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

75

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

76

1.1
Location : createAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotPostAnnouncementWithEmptyString()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED

78

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

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

79

1.1
Location : createAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotPostAnnouncementWithEndBeforeStart()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED

93

1.1
Location : createAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanPostAnnouncements()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::createAnnouncement → KILLED

103

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

2.2
Location : lambda$getAnnouncements$1
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanGetAllAnnouncements()]
replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$getAnnouncements$1 → KILLED

3.3
Location : lambda$getAnnouncements$1
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotGetAllAnnouncementsIfNotInCommons()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$getAnnouncements$1 → KILLED

109

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

110

1.1
Location : getAnnouncements
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotGetAllAnnouncementsIfNotInCommons()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncements → KILLED

116

1.1
Location : getAnnouncements
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanGetAllAnnouncements()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncements → KILLED

125

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

126

1.1
Location : getAnnouncementById
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotGetAnnouncementByIdThatDoesNotExist()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncementById → KILLED

129

1.1
Location : getAnnouncementById
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCanGetAnnouncementById()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::getAnnouncementById → KILLED

147

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

2.2
Location : lambda$editAnnouncement$2
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanEditAnnouncement()]
replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$editAnnouncement$2 → KILLED

3.3
Location : lambda$editAnnouncement$2
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotEditAnnouncementIfNotInCommons()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::lambda$editAnnouncement$2 → KILLED

151

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

152

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotEditAnnouncementIfNotInCommons()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED

156

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

157

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotEditAnnouncementToHaveEmptyStringAsAnnouncement()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED

160

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

165

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

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

166

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotEditAnnouncementToHaveEndBeforeStart()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED

171

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

172

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:userCannotEditAnnouncementThatDoesNotExist()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED

177

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanEditAnnouncement()]
removed call to edu/ucsb/cs156/happiercows/entities/Announcement::setStartDate → KILLED

178

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanEditAnnouncement()]
removed call to edu/ucsb/cs156/happiercows/entities/Announcement::setEndDate → KILLED

179

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanEditAnnouncement()]
removed call to edu/ucsb/cs156/happiercows/entities/Announcement::setAnnouncementText → KILLED

183

1.1
Location : editAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanEditAnnouncement()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::editAnnouncement → KILLED

194

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

195

1.1
Location : deleteAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCannotDeleteAnnouncementsThatDontExist()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::deleteAnnouncement → KILLED

203

1.1
Location : deleteAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanDeleteAnnouncements()]
removed call to edu/ucsb/cs156/happiercows/repositories/AnnouncementRepository::delete → KILLED

204

1.1
Location : deleteAnnouncement
Killed by : edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.AnnouncementsControllerTests]/[method:adminCanDeleteAnnouncements()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/AnnouncementsController::deleteAnnouncement → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3