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

Mutations

60

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

66

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

67

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

71

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

72

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

78

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

90

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

103

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

118

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

119

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

120

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

126

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

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

131

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

135

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

136

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

153

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

163

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

164

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

172

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

175

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

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()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/ChatMessageController::hideChatMessage → KILLED

183

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

186

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

192

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

195

1.1
Location : hideChatMessage
Killed by : edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.ChatMessageControllerTests]/[method:userCanDeleteTheirOwnChatMessages()]
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