ChatMessageController.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.ChatMessage;
19
import edu.ucsb.cs156.happiercows.repositories.ChatMessageRepository;
20
21
import edu.ucsb.cs156.happiercows.entities.User;
22
import edu.ucsb.cs156.happiercows.entities.Farmer;
23
import edu.ucsb.cs156.happiercows.repositories.FarmerRepository;
24
import edu.ucsb.cs156.happiercows.repositories.UserRepository;
25
import edu.ucsb.cs156.happiercows.services.ProfanityFilterService;
26
27
import org.springframework.security.core.Authentication;
28
29
30
import java.time.Duration;
31
import java.time.Instant;
32
import java.util.Optional;
33
34
@Tag(name = "Chat Message")
35
@RequestMapping("/api/chat")
36
@RestController
37
@Slf4j
38
public class ChatMessageController extends ApiController{
39
40
    @Autowired
41
    private ChatMessageRepository chatMessageRepository;
42
43
    @Autowired
44
    private FarmerRepository farmerRepository;
45
46
    @Autowired
47
    private UserRepository userRepository;
48
49
    @Autowired
50
    private ProfanityFilterService profanityFilterService;
51
52
    @Autowired
53
    ObjectMapper mapper;
54
55
    @Operation(summary = "Get all chat messages", description = "Get all chat messages associated with a specific game.")
56
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
57
    @GetMapping("/get")
58
    public ResponseEntity<Object> getChatMessages(@Parameter(description = "The id of the common") @RequestParam Long gameId,
59
                                            @Parameter(name="page") @RequestParam int page,
60
                                            @Parameter(name="size") @RequestParam int size) {
61
        
62
        // Make sure the user is part of the game and showChat is true, or user is an admin
63
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
64 3 1. lambda$getChatMessages$0 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$getChatMessages$0 → KILLED
2. lambda$getChatMessages$0 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$getChatMessages$0 → KILLED
3. getChatMessages : negated conditional → KILLED
        if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
65
            log.info("User is not an admin");
66
            User user = getCurrentUser().getUser();
67
            Long userId = user.getId();
68
            Optional<Farmer> farmerLookup = farmerRepository.findByGameIdAndUserId(gameId, userId);
69
70 1 1. getChatMessages : negated conditional → KILLED
            if (!farmerLookup.isPresent()) {
71 1 1. getChatMessages : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getChatMessages → KILLED
                return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
72
            }
73
74
            Farmer farmer = farmerLookup.get();
75 1 1. getChatMessages : negated conditional → KILLED
            if(!farmer.getGame().isShowChat()){
76 1 1. getChatMessages : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getChatMessages → KILLED
                return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
77
            }
78
        }
79
80
        // Return the list of non-hidden chat messages
81
        Page<ChatMessage> messages = chatMessageRepository.findByGameId(gameId, PageRequest.of(page, size, Sort.by("timestamp").descending()));
82 1 1. getChatMessages : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getChatMessages → KILLED
        return ResponseEntity.ok(messages);
83
    }
84
85
    @Operation(summary = "Get all chat messages (Admins)", description = "Get all chat messages associated with a specific game, even the hidden ones. Used only by admins")
86
    @PreAuthorize("hasRole('ROLE_ADMIN')")
87
    @GetMapping("/admin/get")
88
    public ResponseEntity<Object> getAllChatMessages(@Parameter(description = "The id of the common") @RequestParam Long gameId,
89
                                                    @Parameter(name="page") @RequestParam int page,
90
                                                    @Parameter(name="size") @RequestParam int size) {
91
        
92
        // Return the list of chat messages
93
        Page<ChatMessage> messages = chatMessageRepository.findAllByGameId(gameId, PageRequest.of(page, size, Sort.by("timestamp").descending()));
94 1 1. getAllChatMessages : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getAllChatMessages → KILLED
        return ResponseEntity.ok(messages);
95
    }
96
97
    
98
    @Operation(summary = "Get hidden chat messages", description = "Get all hidden chat messages associated with a specific game. Used only by admins")
99
    @PreAuthorize("hasRole('ROLE_ADMIN')")
100
    @GetMapping("/admin/hidden")
101
    public ResponseEntity<Object> getHiddenChatMessages(@Parameter(description = "The id of the common") @RequestParam Long gameId,
102
                                                    @Parameter(name="page") @RequestParam int page,
103
                                                    @Parameter(name="size") @RequestParam int size) {
104
        
105
        // Return the list of hidden chat messages
106
        Page<ChatMessage> messages = chatMessageRepository.findByGameIdAndHidden(gameId, PageRequest.of(page, size, Sort.by("timestamp").descending()));
107 1 1. getHiddenChatMessages : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getHiddenChatMessages → KILLED
        return ResponseEntity.ok(messages);
108
    }
109
    
110
    
111
    @Operation(summary = "Create a chat message", description = "Create a chat message associated with a specific game")
112
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
113
    @PostMapping("/post")
114
    public ResponseEntity<Object> createChatMessage(@Parameter(description = "The id of the common") @RequestParam Long gameId,
115
                                                    @Parameter(description = "The message to be sent") @RequestParam String content) {
116
        
117
        User user = getCurrentUser().getUser();
118
        Long userId = user.getId();
119
120
        // Read fresh from DB so a cooldown set after login applies immediately
121
        Instant cooldownUntil = userRepository.findById(userId).map(User::getChatCooldownUntil).orElse(null);
122 2 1. createChatMessage : negated conditional → KILLED
2. createChatMessage : negated conditional → KILLED
        if (cooldownUntil != null && cooldownUntil.isAfter(Instant.now())) {
123 1 1. createChatMessage : Replaced long addition with subtraction → KILLED
            long secondsLeft = Duration.between(Instant.now(), cooldownUntil).toSeconds() + 1;
124 1 1. createChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED
            return ResponseEntity.status(HttpStatus.FORBIDDEN)
125
                .body(genericMessage("You are on a chat cooldown for %d more seconds".formatted(secondsLeft)));
126
        }
127
128
        // Make sure the user is part of the game and showChat is true, or user is an admin
129
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
130 3 1. createChatMessage : negated conditional → KILLED
2. lambda$createChatMessage$0 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$createChatMessage$0 → KILLED
3. lambda$createChatMessage$0 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$createChatMessage$0 → KILLED
        if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
131
            log.info("User is not an admin");
132
            Optional<Farmer> farmerLookup = farmerRepository.findByGameIdAndUserId(gameId, userId);
133
134 1 1. createChatMessage : negated conditional → KILLED
            if (!farmerLookup.isPresent()) {
135 1 1. createChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED
                return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
136
            }
137
138
            Farmer farmer = farmerLookup.get();
139 1 1. createChatMessage : negated conditional → KILLED
            if(!farmer.getGame().isShowChat()){
140 1 1. createChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED
                return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
141
            }
142
        }
143
144
        // Create the chat message, censoring any banned words before it is stored
145
        ChatMessage chatMessage = ChatMessage.builder()
146
        .gameId(gameId)
147
        .userId(userId)
148
        .message(profanityFilterService.censor(content))
149
        .hidden(false)
150
        .dm(false)
151
        .toUserId(0)
152
        .build();
153
154
        // Save the message
155
        chatMessageRepository.save(chatMessage);
156
157 1 1. createChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED
        return ResponseEntity.ok(chatMessage);
158
    }
159
160
    @Operation(summary = "Delete a chat message", description = "Delete a chat message associated with a specific game")
161
    @PreAuthorize("hasAnyRole('ROLE_USER', 'ROLE_ADMIN')")
162
    @PutMapping("/hide")
163
    public ResponseEntity<Object> hideChatMessage(@Parameter(description = "The id of the chat message") @RequestParam Long chatMessageId) {
164
165
        // Try to get the chat message
166
        Optional<ChatMessage> chatMessageLookup = chatMessageRepository.findById(chatMessageId);
167 1 1. hideChatMessage : negated conditional → KILLED
        if (!chatMessageLookup.isPresent()) {
168 1 1. hideChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED
            return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
169
        }
170
        ChatMessage chatMessage = chatMessageLookup.get();
171
172
        User user = getCurrentUser().getUser();
173
        Long userId = user.getId();
174
175
        // Check if the user is the author of the message
176 1 1. hideChatMessage : negated conditional → KILLED
        if (chatMessage.getUserId() != userId) {
177
            // Check if the user is an admin
178
            Authentication auth = SecurityContextHolder.getContext().getAuthentication();
179 3 1. hideChatMessage : negated conditional → KILLED
2. lambda$hideChatMessage$0 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$hideChatMessage$0 → KILLED
3. lambda$hideChatMessage$0 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$hideChatMessage$0 → KILLED
            if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
180 1 1. hideChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED
                return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
181
            }
182
        }
183
184
        // Check if showChat is true
185
        Optional<Farmer> farmerLookup = farmerRepository.findByGameIdAndUserId(chatMessage.getGameId(), userId);
186
        Farmer farmer = farmerLookup.get();
187 1 1. hideChatMessage : negated conditional → KILLED
        if (!farmer.getGame().isShowChat()){
188
            // Check if the user is an admin
189
            Authentication auth = SecurityContextHolder.getContext().getAuthentication();
190 3 1. lambda$hideChatMessage$1 : replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$hideChatMessage$1 → KILLED
2. lambda$hideChatMessage$1 : replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$hideChatMessage$1 → KILLED
3. hideChatMessage : negated conditional → KILLED
            if (!auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))){
191 1 1. hideChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED
                return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
192
            }
193
        }
194
195
        // Hide the message
196 1 1. hideChatMessage : removed call to edu/ucsb/cs156/happiercows/entities/ChatMessage::setHidden → KILLED
        chatMessage.setHidden(true);
197
        chatMessageRepository.save(chatMessage);
198
199 1 1. hideChatMessage : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED
        return ResponseEntity.ok(chatMessage);
200
    }
201
202
    
203
204
}

Mutations

64

1.1
Location : lambda$getChatMessages$0
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanGetChatMessages()]
replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$getChatMessages$0 → KILLED

2.2
Location : lambda$getChatMessages$0
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userNotInGameCannotGetChatMessages()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$getChatMessages$0 → KILLED

3.3
Location : getChatMessages
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanGetChatMessages()]
negated conditional → KILLED

70

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

71

1.1
Location : getChatMessages
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userNotInGameCannotGetChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getChatMessages → KILLED

75

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

76

1.1
Location : getChatMessages
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userCannotInteractWithChatIfShowChatIsFalse()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getChatMessages → KILLED

82

1.1
Location : getChatMessages
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanGetChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getChatMessages → KILLED

94

1.1
Location : getAllChatMessages
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanGetAllChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getAllChatMessages → KILLED

107

1.1
Location : getHiddenChatMessages
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanGetHiddenChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::getHiddenChatMessages → KILLED

122

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

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

123

1.1
Location : createChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userOnCooldownCannotPostChatMessages()]
Replaced long addition with subtraction → KILLED

124

1.1
Location : createChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userOnCooldownCannotPostChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED

130

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

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

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

134

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

135

1.1
Location : createChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userNotInGameCannotPostChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED

139

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

140

1.1
Location : createChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userCannotInteractWithChatIfShowChatIsFalse()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED

157

1.1
Location : createChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userInGameCanPostChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::createChatMessage → KILLED

167

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

168

1.1
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCannotHideChatMessagesThatDontExist()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED

176

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

179

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

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

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

180

1.1
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userCannotDeleteOtherUsersChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED

187

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

190

1.1
Location : lambda$hideChatMessage$1
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanDeleteOtherUsersChatMessages()]
replaced boolean return with false for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$hideChatMessage$1 → KILLED

2.2
Location : lambda$hideChatMessage$1
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userCannotInteractWithChatIfShowChatIsFalse()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::lambda$hideChatMessage$1 → KILLED

3.3
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanDeleteOtherUsersChatMessages()]
negated conditional → KILLED

191

1.1
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userCannotInteractWithChatIfShowChatIsFalse()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED

196

1.1
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanDeleteOtherUsersChatMessages()]
removed call to edu/ucsb/cs156/happiercows/entities/ChatMessage::setHidden → KILLED

199

1.1
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:adminCanDeleteOtherUsersChatMessages()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1