CoursesController.java

1
package edu.ucsb.cs156.frontiers.controllers;
2
3
import com.fasterxml.jackson.core.JsonProcessingException;
4
import edu.ucsb.cs156.frontiers.config.AllowApiKeyAccess;
5
import edu.ucsb.cs156.frontiers.entities.Course;
6
import edu.ucsb.cs156.frontiers.entities.CourseStaff;
7
import edu.ucsb.cs156.frontiers.entities.RosterStudent;
8
import edu.ucsb.cs156.frontiers.entities.User;
9
import edu.ucsb.cs156.frontiers.enums.OrgStatus;
10
import edu.ucsb.cs156.frontiers.enums.RosterStatus;
11
import edu.ucsb.cs156.frontiers.enums.School;
12
import edu.ucsb.cs156.frontiers.errors.EntityNotFoundException;
13
import edu.ucsb.cs156.frontiers.errors.InvalidInstallationTypeException;
14
import edu.ucsb.cs156.frontiers.models.CourseWarning;
15
import edu.ucsb.cs156.frontiers.models.CurrentUser;
16
import edu.ucsb.cs156.frontiers.repositories.AdminRepository;
17
import edu.ucsb.cs156.frontiers.repositories.CourseRepository;
18
import edu.ucsb.cs156.frontiers.repositories.CourseStaffRepository;
19
import edu.ucsb.cs156.frontiers.repositories.InstructorRepository;
20
import edu.ucsb.cs156.frontiers.repositories.RosterStudentRepository;
21
import edu.ucsb.cs156.frontiers.repositories.UserRepository;
22
import edu.ucsb.cs156.frontiers.services.CanvasApiTokenSecurityService;
23
import edu.ucsb.cs156.frontiers.services.CourseStaffService;
24
import edu.ucsb.cs156.frontiers.services.OrganizationLinkerService;
25
import edu.ucsb.cs156.jobs.repositories.JobsRepository;
26
import io.swagger.v3.oas.annotations.Operation;
27
import io.swagger.v3.oas.annotations.Parameter;
28
import io.swagger.v3.oas.annotations.tags.Tag;
29
import java.security.NoSuchAlgorithmException;
30
import java.security.spec.InvalidKeySpecException;
31
import java.util.ArrayList;
32
import java.util.List;
33
import java.util.Map;
34
import java.util.Objects;
35
import java.util.Optional;
36
import java.util.stream.Collectors;
37
import java.util.stream.StreamSupport;
38
import lombok.extern.slf4j.Slf4j;
39
import org.springframework.beans.factory.annotation.Autowired;
40
import org.springframework.http.HttpHeaders;
41
import org.springframework.http.HttpStatus;
42
import org.springframework.http.ResponseEntity;
43
import org.springframework.security.access.prepost.PreAuthorize;
44
import org.springframework.transaction.annotation.Transactional;
45
import org.springframework.web.bind.annotation.*;
46
47
@Tag(name = "Course")
48
@RequestMapping("/api/courses")
49
@RestController
50
@Slf4j
51
public class CoursesController extends ApiController {
52
53
  @Autowired private CourseRepository courseRepository;
54
55
  @Autowired private UserRepository userRepository;
56
57
  @Autowired private RosterStudentRepository rosterStudentRepository;
58
59
  @Autowired private CourseStaffRepository courseStaffRepository;
60
61
  @Autowired private InstructorRepository instructorRepository;
62
63
  @Autowired private AdminRepository adminRepository;
64
65
  @Autowired private CanvasApiTokenSecurityService canvasApiTokenSecurityService;
66
67
  @Autowired private OrganizationLinkerService linkerService;
68
69
  @Autowired private JobsRepository jobsRepository;
70
71
  @Autowired private CourseStaffService courseStaffService;
72
73
  /**
74
   * This method creates a new Course. The instructor (the user creating the course) is also added
75
   * as a staff member of the new course.
76
   *
77
   * @param courseName the name of the course
78
   * @param term the term of the course
79
   * @param school the school of the course
80
   * @param canvasApiToken the Canvas API token (optional)
81
   * @param canvasCourseId the Canvas course ID (optional)
82
   */
83
  @Operation(summary = "Create a new course")
84
  @PreAuthorize("hasRole('ROLE_ADMIN') || hasRole('ROLE_INSTRUCTOR')")
85
  @PostMapping("/post")
86
  public InstructorCourseView postCourse(
87
      @Parameter(name = "courseName") @RequestParam String courseName,
88
      @Parameter(name = "term") @RequestParam String term,
89
      @Parameter(name = "school") @RequestParam School school,
90
      @Parameter(name = "canvasApiToken") @RequestParam(required = false) String canvasApiToken,
91
      @Parameter(name = "canvasCourseId") @RequestParam(required = false) String canvasCourseId) {
92
    // get current date right now and set status to pending
93
    CurrentUser currentUser = getCurrentUser();
94
    Course course =
95
        Course.builder()
96
            .courseName(courseName)
97
            .term(term)
98
            .school(school)
99
            .instructorEmail(currentUser.getUser().getEmail().strip())
100
            .canvasApiToken(canvasApiTokenSecurityService.encrypt(canvasApiToken))
101
            .canvasCourseId(canvasCourseId)
102
            .build();
103
    Course savedCourse = courseRepository.save(course);
104 1 1. postCourse : removed call to edu/ucsb/cs156/frontiers/services/CourseStaffService::ensureInstructorIsStaff → KILLED
    courseStaffService.ensureInstructorIsStaff(savedCourse);
105
106 1 1. postCourse : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::postCourse → KILLED
    return new InstructorCourseView(savedCourse);
107
  }
108
109
  /** Projection of Course entity with fields that are relevant for instructors and admins */
110
  public static record InstructorCourseView(
111
      Long id,
112
      String installationId,
113
      String orgName,
114
      String courseName,
115
      String term,
116
      School school,
117
      String instructorEmail,
118
      boolean hideBasePermissionWarning,
119
      boolean hideFreePlanWarning,
120
      int numStudents,
121
      int numStaff) {
122
123
    // Creates view from Course entity
124
    public InstructorCourseView(Course c) {
125
      this(
126
          c.getId(),
127
          c.getInstallationId(),
128
          c.getOrgName(),
129
          c.getCourseName(),
130
          c.getTerm(),
131
          c.getSchool(),
132
          c.getInstructorEmail(),
133
          c.getHideBasePermissionWarning(),
134
          c.getHideFreePlanWarning(),
135 1 1. <init> : negated conditional → KILLED
          c.getRosterStudents() != null ? c.getRosterStudents().size() : 0,
136 1 1. <init> : negated conditional → KILLED
          c.getCourseStaff() != null ? c.getCourseStaff().size() : 0);
137
    }
138
  }
139
140
  /**
141
   * This method returns a list of courses.
142
   *
143
   * @return a list of all courses for an instructor.
144
   */
145
  @Operation(summary = "List all courses for an instructor")
146
  @PreAuthorize("hasRole('ROLE_INSTRUCTOR')")
147
  @GetMapping("/allForInstructors")
148
  public Iterable<InstructorCourseView> allForInstructors() {
149
    CurrentUser currentUser = getCurrentUser();
150
    String instructorEmail = currentUser.getUser().getEmail();
151
    List<Course> courses = courseRepository.findByInstructorEmail(instructorEmail);
152
153
    List<InstructorCourseView> courseViews =
154
        courses.stream().map(InstructorCourseView::new).collect(Collectors.toList());
155 1 1. allForInstructors : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::allForInstructors → KILLED
    return courseViews;
156
  }
157
158
  /**
159
   * This method returns a list of courses.
160
   *
161
   * @return a list of all courses for an admin.
162
   */
163
  @Operation(summary = "List all courses for an admin")
164
  @PreAuthorize("hasRole('ROLE_ADMIN')")
165
  @GetMapping("/allForAdmins")
166
  public Iterable<InstructorCourseView> allForAdmins() {
167
    List<Course> courses = courseRepository.findAll();
168
169
    List<InstructorCourseView> courseViews =
170
        courses.stream().map(InstructorCourseView::new).collect(Collectors.toList());
171 1 1. allForAdmins : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::allForAdmins → KILLED
    return courseViews;
172
  }
173
174
  /**
175
   * This method returns single course by its id
176
   *
177
   * @return a course
178
   */
179
  @Operation(summary = "Get course by id")
180
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #id)")
181
  @GetMapping("/{id}")
182
  public InstructorCourseView getCourseById(@Parameter(name = "id") @PathVariable Long id) {
183
    Course course =
184
        courseRepository
185
            .findById(id)
186 1 1. lambda$getCourseById$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseById$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, id));
187
    // Convert to InstructorCourseView
188
    InstructorCourseView courseView = new InstructorCourseView(course);
189 1 1. getCourseById : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseById → KILLED
    return courseView;
190
  }
191
192
  /**
193
   * This method returns the Canvas course ID and partially obscured Canvas token for a course by
194
   * its id. If the token is less than or equal to 3 characters long, it is returned in full.
195
   * Otherwise, all but the last three characters are replaced with asterisks. This is okay because
196
   * such short tokens are not generated by Canvas.
197
   *
198
   * @param courseId the id of the course
199
   * @return a map with courseId, canvasCourseId, and obscured canvasApiToken
200
   */
201
  @Operation(summary = "Get course Canvas course ID and Canvas token (partially obscured)")
202
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
203
  @GetMapping("getCanvasInfo")
204
  public Map<String, String> getCourseCanvasInfo(
205
      @Parameter(name = "courseId") @RequestParam Long courseId) {
206
    Course course =
207
        courseRepository
208
            .findById(courseId)
209 1 1. lambda$getCourseCanvasInfo$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseCanvasInfo$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
210
211
    String obscuredToken = null;
212
213 1 1. getCourseCanvasInfo : negated conditional → KILLED
    if (course.getCanvasApiToken() != null) {
214
      String token = canvasApiTokenSecurityService.decrypt(course.getCanvasApiToken());
215 2 1. getCourseCanvasInfo : negated conditional → KILLED
2. getCourseCanvasInfo : changed conditional boundary → KILLED
      if (token.length() < 4) {
216
        obscuredToken = token;
217
      } else {
218 1 1. getCourseCanvasInfo : Replaced integer subtraction with addition → KILLED
        String lastThree = token.substring(token.length() - 3);
219 1 1. getCourseCanvasInfo : Replaced integer subtraction with addition → KILLED
        obscuredToken = "*".repeat(token.length() - 3) + lastThree;
220
      }
221
    }
222 1 1. getCourseCanvasInfo : replaced return value with Collections.emptyMap for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseCanvasInfo → KILLED
    return Map.of(
223
        "courseId", course.getId().toString(),
224 1 1. getCourseCanvasInfo : negated conditional → KILLED
        "canvasCourseId", course.getCanvasCourseId() != null ? course.getCanvasCourseId() : "",
225 1 1. getCourseCanvasInfo : negated conditional → KILLED
        "canvasApiToken", obscuredToken != null ? obscuredToken : "");
226
  }
227
228
  /**
229
   * This is the outgoing method, redirecting from Frontiers to GitHub to allow a Course to be
230
   * linked to a GitHub Organization. It redirects from Frontiers to the GitHub app installation
231
   * process, and will return with the {@link #addInstallation(Optional, String, String, Long)
232
   * addInstallation()} endpoint
233
   *
234
   * @param courseId id of the course to be linked to
235
   * @return dynamically loaded url to install Frontiers to a Github Organization, with the courseId
236
   *     marked as the state parameter, which GitHub will return.
237
   */
238
  @Operation(summary = "Authorize Frontiers to a Github Course")
239
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
240
  @GetMapping("/redirect")
241
  public ResponseEntity<Void> linkCourse(@Parameter Long courseId)
242
      throws JsonProcessingException, NoSuchAlgorithmException, InvalidKeySpecException {
243
    String newUrl = linkerService.getRedirectUrl();
244
    newUrl += "/installations/new?state=" + courseId;
245
    // found this convenient solution here:
246
    // https://stackoverflow.com/questions/29085295/spring-mvc-restcontroller-and-redirect
247 1 1. linkCourse : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::linkCourse → KILLED
    return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY)
248
        .header(HttpHeaders.LOCATION, newUrl)
249
        .build();
250
  }
251
252
  /**
253
   * @param installation_id id of the incoming GitHub Organization installation
254
   * @param setup_action whether the permissions are installed or updated. Required RequestParam but
255
   *     not used by the method.
256
   * @param code token to be exchanged with GitHub to ensure the request is legitimate and not
257
   *     spoofed.
258
   * @param state id of the Course to be linked with the GitHub installation.
259
   * @return ResponseEntity, returning /success if the course was successfully linked or /noperms if
260
   *     the user does not have the permission to install the application on GitHub. Alternately
261
   *     returns 403 Forbidden if the user is not the creator.
262
   */
263
  @Operation(summary = "Link a Course to a Github Organization by installing Github App")
264
  @PreAuthorize("hasRole('ROLE_ADMIN') || hasRole('ROLE_INSTRUCTOR')")
265
  @GetMapping("link")
266
  public ResponseEntity<Void> addInstallation(
267
      @Parameter(name = "installationId") @RequestParam Optional<String> installation_id,
268
      @Parameter(name = "setupAction") @RequestParam String setup_action,
269
      @Parameter(name = "code") @RequestParam String code,
270
      @Parameter(name = "state") @RequestParam Long state)
271
      throws NoSuchAlgorithmException, InvalidKeySpecException, JsonProcessingException {
272 1 1. addInstallation : negated conditional → KILLED
    if (installation_id.isEmpty()) {
273 1 1. addInstallation : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::addInstallation → KILLED
      return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY)
274
          .header(HttpHeaders.LOCATION, "/courses/nopermissions")
275
          .build();
276
    } else {
277
      Course course =
278
          courseRepository
279
              .findById(state)
280 1 1. lambda$addInstallation$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$addInstallation$0 → KILLED
              .orElseThrow(() -> new EntityNotFoundException(Course.class, state));
281 1 1. addInstallation : negated conditional → KILLED
      if (!isCurrentUserAdmin()
282 1 1. addInstallation : negated conditional → KILLED
          && !course.getInstructorEmail().equals(getCurrentUser().getUser().getEmail())) {
283 1 1. addInstallation : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::addInstallation → KILLED
        return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
284
      } else {
285
        String orgName = linkerService.getOrgName(installation_id.get());
286 1 1. addInstallation : removed call to edu/ucsb/cs156/frontiers/entities/Course::setInstallationId → KILLED
        course.setInstallationId(installation_id.get());
287 1 1. addInstallation : removed call to edu/ucsb/cs156/frontiers/entities/Course::setOrgName → KILLED
        course.setOrgName(orgName);
288
        course
289
            .getRosterStudents()
290 1 1. addInstallation : removed call to java/util/List::forEach → KILLED
            .forEach(
291
                rs -> {
292 1 1. lambda$addInstallation$1 : removed call to edu/ucsb/cs156/frontiers/entities/RosterStudent::setOrgStatus → KILLED
                  rs.setOrgStatus(OrgStatus.JOINCOURSE);
293
                });
294
        course
295
            .getCourseStaff()
296 1 1. addInstallation : removed call to java/util/List::forEach → KILLED
            .forEach(
297
                cs -> {
298 1 1. lambda$addInstallation$2 : removed call to edu/ucsb/cs156/frontiers/entities/CourseStaff::setOrgStatus → KILLED
                  cs.setOrgStatus(OrgStatus.JOINCOURSE);
299
                });
300
        courseRepository.save(course);
301 1 1. addInstallation : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::addInstallation → KILLED
        return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY)
302
            .header(HttpHeaders.LOCATION, "/login/success")
303
            .build();
304
      }
305
    }
306
  }
307
308
  /**
309
   * This method handles the InvalidInstallationTypeException.
310
   *
311
   * @param e the exception
312
   * @return a map with the type and message of the exception
313
   */
314
  @ExceptionHandler({InvalidInstallationTypeException.class})
315
  @ResponseStatus(HttpStatus.BAD_REQUEST)
316
  public Object handleInvalidInstallationType(Throwable e) {
317 1 1. handleInvalidInstallationType : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::handleInvalidInstallationType → KILLED
    return Map.of(
318
        "type", e.getClass().getSimpleName(),
319
        "message", e.getMessage());
320
  }
321
322
  public record RosterStudentCoursesDTO(
323
      Long id,
324
      String installationId,
325
      String orgName,
326
      String courseName,
327
      String term,
328
      String school,
329
      OrgStatus studentStatus,
330
      Long rosterStudentId) {}
331
332
  /**
333
   * This method returns a list of courses that the current user is enrolled.
334
   *
335
   * @return a list of courses in the DTO form along with the student status in the organization.
336
   */
337
  @Operation(summary = "List all courses for the current student, including their org status")
338
  @PreAuthorize("hasRole('ROLE_USER')")
339
  @GetMapping("/list")
340
  public List<RosterStudentCoursesDTO> listCoursesForCurrentUser() {
341
    String email = getCurrentUser().getUser().getEmail();
342
    Iterable<RosterStudent> rosterStudentsIterable = rosterStudentRepository.findAllByEmail(email);
343
    List<RosterStudent> rosterStudents = new ArrayList<>();
344 1 1. listCoursesForCurrentUser : removed call to java/lang/Iterable::forEach → KILLED
    rosterStudentsIterable.forEach(rosterStudents::add);
345 1 1. listCoursesForCurrentUser : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::listCoursesForCurrentUser → KILLED
    return rosterStudents.stream()
346
        .map(
347
            rs -> {
348
              Course course = rs.getCourse();
349
              RosterStudentCoursesDTO rsDto =
350
                  new RosterStudentCoursesDTO(
351
                      course.getId(),
352
                      course.getInstallationId(),
353
                      course.getOrgName(),
354
                      course.getCourseName(),
355
                      course.getTerm(),
356
                      course.getSchool().getDisplayName(),
357
                      rs.getOrgStatus(),
358
                      rs.getId());
359 1 1. lambda$listCoursesForCurrentUser$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$listCoursesForCurrentUser$0 → KILLED
              return rsDto;
360
            })
361
        .collect(Collectors.toList());
362
  }
363
364
  public record StaffCoursesDTO(
365
      Long id,
366
      String installationId,
367
      String orgName,
368
      String courseName,
369
      String term,
370
      School school,
371
      OrgStatus studentStatus,
372
      Long staffId) {}
373
374
  public enum EmailTypes {
375
    STUDENTS,
376
    STAFF,
377
    ALL
378
  }
379
380
  public enum EmailFormats {
381
    COMMA_SEPARATED,
382
    ONE_PER_LINE
383
  }
384
385
  /**
386
   * student see what courses they appear as staff in
387
   *
388
   * @param studentId the id of the student making request
389
   * @return a list of all courses student is staff in
390
   */
391
  @Operation(summary = "Student see what courses they appear as staff in")
392
  @PreAuthorize("hasRole('ROLE_USER')")
393
  @GetMapping("/staffCourses")
394
  public List<StaffCoursesDTO> staffCourses() {
395
    CurrentUser currentUser = getCurrentUser();
396
    User user = currentUser.getUser();
397
398
    String email = user.getEmail();
399
400
    List<CourseStaff> staffMembers = courseStaffRepository.findAllByEmail(email);
401 1 1. staffCourses : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::staffCourses → KILLED
    return staffMembers.stream()
402
        .map(
403
            s -> {
404
              Course course = s.getCourse();
405
              StaffCoursesDTO sDto =
406
                  new StaffCoursesDTO(
407
                      course.getId(),
408
                      course.getInstallationId(),
409
                      course.getOrgName(),
410
                      course.getCourseName(),
411
                      course.getTerm(),
412
                      course.getSchool(),
413
                      s.getOrgStatus(),
414
                      s.getId());
415 1 1. lambda$staffCourses$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$staffCourses$0 → KILLED
              return sDto;
416
            })
417
        .collect(Collectors.toList());
418
  }
419
420
  @Operation(summary = "Update instructor email for a course (admin only)")
421
  @PreAuthorize("hasRole('ROLE_ADMIN')")
422
  @PutMapping("/updateInstructor")
423
  public InstructorCourseView updateInstructorEmail(
424
      @Parameter(name = "courseId") @RequestParam Long courseId,
425
      @Parameter(name = "instructorEmail") @RequestParam String instructorEmail) {
426
427
    instructorEmail = instructorEmail.strip();
428
429
    Course course =
430
        courseRepository
431
            .findById(courseId)
432 1 1. lambda$updateInstructorEmail$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$updateInstructorEmail$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
433
434
    // Validate that the email exists in either instructor or admin table
435
    boolean isInstructor = instructorRepository.existsByEmail(instructorEmail);
436
    boolean isAdmin = adminRepository.existsByEmail(instructorEmail);
437
438 2 1. updateInstructorEmail : negated conditional → KILLED
2. updateInstructorEmail : negated conditional → KILLED
    if (!isInstructor && !isAdmin) {
439
      throw new IllegalArgumentException("Email must belong to either an instructor or admin");
440
    }
441
442 1 1. updateInstructorEmail : removed call to edu/ucsb/cs156/frontiers/entities/Course::setInstructorEmail → KILLED
    course.setInstructorEmail(instructorEmail);
443
    Course savedCourse = courseRepository.save(course);
444
445 1 1. updateInstructorEmail : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateInstructorEmail → KILLED
    return new InstructorCourseView(savedCourse);
446
  }
447
448
  @Operation(summary = "Get course emails")
449
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
450
  @GetMapping("/emails")
451
  @AllowApiKeyAccess
452
  public String getCourseEmails(
453
      @Parameter(name = "courseId") @RequestParam Long courseId,
454
      @Parameter(name = "type") @RequestParam(defaultValue = "STUDENTS") EmailTypes type,
455
      @Parameter(name = "team") @RequestParam(required = false) String team,
456
      @Parameter(name = "format") @RequestParam(defaultValue = "ONE_PER_LINE")
457
          EmailFormats format) {
458
459
    List<String> staffEmails =
460
        StreamSupport.stream(courseStaffRepository.findByCourseId(courseId).spliterator(), false)
461
            .map(CourseStaff::getEmail)
462
            .filter(Objects::nonNull)
463
            .sorted()
464
            .collect(Collectors.toList());
465
466
    // Dropped students are not part of the current roster, so they are never included
467
    List<String> studentEmails =
468
        StreamSupport.stream(rosterStudentRepository.findByCourseId(courseId).spliterator(), false)
469 2 1. lambda$getCourseEmails$0 : replaced boolean return with true for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseEmails$0 → KILLED
2. lambda$getCourseEmails$0 : negated conditional → KILLED
            .filter(student -> student.getRosterStatus() != RosterStatus.DROPPED)
470 4 1. lambda$getCourseEmails$1 : negated conditional → KILLED
2. lambda$getCourseEmails$1 : replaced boolean return with true for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseEmails$1 → KILLED
3. lambda$getCourseEmails$1 : negated conditional → KILLED
4. lambda$getCourseEmails$1 : negated conditional → KILLED
            .filter(student -> team == null || team.isBlank() || student.getTeams().contains(team))
471
            .map(RosterStudent::getEmail)
472
            .filter(Objects::nonNull)
473
            .sorted()
474
            .collect(Collectors.toList());
475
476
    List<String> emails = studentEmails;
477 1 1. getCourseEmails : negated conditional → KILLED
    if (type == EmailTypes.STAFF) {
478
      emails = staffEmails;
479 1 1. getCourseEmails : negated conditional → KILLED
    } else if (type == EmailTypes.ALL) {
480
      emails = new ArrayList<>(staffEmails);
481
      emails.addAll(studentEmails);
482
    }
483
484 1 1. getCourseEmails : negated conditional → KILLED
    String separator = format == EmailFormats.COMMA_SEPARATED ? "," : "\r\n";
485 1 1. getCourseEmails : replaced return value with "" for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseEmails → KILLED
    return String.join(separator, emails);
486
  }
487
488
  @Operation(summary = "Delete a course")
489
  @PreAuthorize("hasRole('ROLE_ADMIN')")
490
  @DeleteMapping("")
491
  @Transactional
492
  public Object deleteCourse(@RequestParam Long courseId)
493
      throws NoSuchAlgorithmException, InvalidKeySpecException {
494
    Course course =
495
        courseRepository
496
            .findById(courseId)
497 1 1. lambda$deleteCourse$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$deleteCourse$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
498
499
    // Check if course has roster students or staff
500 2 1. deleteCourse : negated conditional → KILLED
2. deleteCourse : negated conditional → KILLED
    if (!course.getRosterStudents().isEmpty() || !course.getCourseStaff().isEmpty()) {
501
      throw new IllegalArgumentException("Cannot delete course with students or staff");
502
    }
503
504 1 1. deleteCourse : removed call to edu/ucsb/cs156/frontiers/services/OrganizationLinkerService::unenrollOrganization → KILLED
    linkerService.unenrollOrganization(course);
505 1 1. deleteCourse : removed call to edu/ucsb/cs156/jobs/repositories/JobsRepository::deleteByScopeTypeAndScopeId → KILLED
    jobsRepository.deleteByScopeTypeAndScopeId("course", courseId);
506 1 1. deleteCourse : removed call to edu/ucsb/cs156/frontiers/repositories/CourseRepository::delete → KILLED
    courseRepository.delete(course);
507 1 1. deleteCourse : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::deleteCourse → KILLED
    return genericMessage("Course with id %s deleted".formatted(course.getId()));
508
  }
509
510
  /**
511
   * This method updates an existing course.
512
   *
513
   * @param courseId the id of the course to update
514
   * @param courseName the new name of the course
515
   * @param term the new term of the course
516
   * @param school the new school of the course
517
   * @return the updated course
518
   */
519
  @Operation(summary = "Update an existing course")
520
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
521
  @PutMapping("")
522
  public InstructorCourseView updateCourse(
523
      @Parameter(name = "courseId") @RequestParam Long courseId,
524
      @Parameter(name = "courseName") @RequestParam String courseName,
525
      @Parameter(name = "term") @RequestParam String term,
526
      @Parameter(name = "school") @RequestParam School school) {
527
    Course course =
528
        courseRepository
529
            .findById(courseId)
530 1 1. lambda$updateCourse$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$updateCourse$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
531
532 1 1. updateCourse : removed call to edu/ucsb/cs156/frontiers/entities/Course::setCourseName → KILLED
    course.setCourseName(courseName);
533 1 1. updateCourse : removed call to edu/ucsb/cs156/frontiers/entities/Course::setTerm → KILLED
    course.setTerm(term);
534 1 1. updateCourse : removed call to edu/ucsb/cs156/frontiers/entities/Course::setSchool → KILLED
    course.setSchool(school);
535
536
    Course savedCourse = courseRepository.save(course);
537
538 1 1. updateCourse : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateCourse → KILLED
    return new InstructorCourseView(savedCourse);
539
  }
540
541
  /**
542
   * This method updates an existing course.
543
   *
544
   * @param courseId the id of the course to update
545
   * @param courseName the new name of the course
546
   * @param term the new term of the course
547
   * @param school the new school of the course
548
   * @param canvasApiToken the new Canvas API token for the course
549
   * @param canvasCourseId the new Canvas course ID
550
   * @return the updated course
551
   */
552
  @Operation(summary = "Update an existing course with Canvas token and course ID")
553
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
554
  @PutMapping("/updateCourseCanvasToken")
555
  public InstructorCourseView updateCourseWithCanvasToken(
556
      @Parameter(name = "courseId") @RequestParam Long courseId,
557
      @Parameter(name = "canvasApiToken") @RequestParam(required = false) String canvasApiToken,
558
      @Parameter(name = "canvasCourseId") @RequestParam(required = false) String canvasCourseId) {
559
    Course course =
560
        courseRepository
561
            .findById(courseId)
562 1 1. lambda$updateCourseWithCanvasToken$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$updateCourseWithCanvasToken$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
563
564
    String existingCanvasToken = canvasApiTokenSecurityService.decrypt(course.getCanvasApiToken());
565 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
    if (canvasApiToken != null
566 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasApiToken.isEmpty()
567 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasApiToken.equals(existingCanvasToken)) {
568 1 1. updateCourseWithCanvasToken : removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasApiToken → KILLED
      course.setCanvasApiToken(canvasApiTokenSecurityService.encrypt(canvasApiToken));
569
    }
570
571 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
    if (canvasCourseId != null
572 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasCourseId.isEmpty()
573 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasCourseId.equals(course.getCanvasCourseId())) {
574 1 1. updateCourseWithCanvasToken : removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasCourseId → KILLED
      course.setCanvasCourseId(canvasCourseId);
575
    }
576
577
    Course savedCourse = courseRepository.save(course);
578
579 1 1. updateCourseWithCanvasToken : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateCourseWithCanvasToken → KILLED
    return new InstructorCourseView(savedCourse);
580
  }
581
582
  @Operation(summary = "Get course warnings")
583
  @GetMapping("/warnings/{courseId}")
584
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
585
  public CourseWarning warnings(@PathVariable @Parameter Long courseId) throws Exception {
586
    Course course =
587
        courseRepository
588
            .findById(courseId)
589 1 1. lambda$warnings$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$warnings$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
590 1 1. warnings : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::warnings → KILLED
    return linkerService.checkCourseWarnings(course);
591
  }
592
593
  @Operation(summary = "Hide base permission warning for a course")
594
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
595
  @PostMapping("/warnings/hideBasePermissionWarning/{courseId}")
596
  public Object hideBasePermissionWarning(@PathVariable @Parameter Long courseId) {
597
    Course course =
598
        courseRepository
599
            .findById(courseId)
600 1 1. lambda$hideBasePermissionWarning$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$hideBasePermissionWarning$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
601
602 1 1. hideBasePermissionWarning : removed call to edu/ucsb/cs156/frontiers/entities/Course::setHideBasePermissionWarning → KILLED
    course.setHideBasePermissionWarning(true);
603
    courseRepository.save(course);
604
605 1 1. hideBasePermissionWarning : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::hideBasePermissionWarning → KILLED
    return genericMessage(
606
        "hideBasePermissionWarning set to true for course with id %s".formatted(courseId));
607
  }
608
609
  @Operation(summary = "Hide free plan warning for a course")
610
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
611
  @PostMapping("/warnings/hideFreePlanWarning/{courseId}")
612
  public Object hideFreePlanWarning(@PathVariable @Parameter Long courseId) {
613
    Course course =
614
        courseRepository
615
            .findById(courseId)
616 1 1. lambda$hideFreePlanWarning$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$hideFreePlanWarning$0 → KILLED
            .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
617
618 1 1. hideFreePlanWarning : removed call to edu/ucsb/cs156/frontiers/entities/Course::setHideFreePlanWarning → KILLED
    course.setHideFreePlanWarning(true);
619
    courseRepository.save(course);
620
621 1 1. hideFreePlanWarning : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::hideFreePlanWarning → KILLED
    return genericMessage(
622
        "hideFreePlanWarning set to true for course with id %s".formatted(courseId));
623
  }
624
}

Mutations

104

1.1
Location : postCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testPostCourse_byInstructor()]
removed call to edu/ucsb/cs156/frontiers/services/CourseStaffService::ensureInstructorIsStaff → KILLED

106

1.1
Location : postCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testPostCourse_byInstructor()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::postCourse → KILLED

135

1.1
Location : <init>
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testInstructorCourseView_withNullRosterStudents()]
negated conditional → KILLED

136

1.1
Location : <init>
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testInstructorCourseView_withNullCourseStaff()]
negated conditional → KILLED

155

1.1
Location : allForInstructors
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testAllCourses_ROLE_INSTRUCTOR()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::allForInstructors → KILLED

171

1.1
Location : allForAdmins
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testAllCourses_ROLE_ADMIN()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::allForAdmins → KILLED

186

1.1
Location : lambda$getCourseById$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testGetCourseById_courseDoesNotExist()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseById$0 → KILLED

189

1.1
Location : getCourseById
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testGetCourseById()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseById → KILLED

209

1.1
Location : lambda$getCourseCanvasInfo$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testGetCanvasInfo_courseDoesNotExist()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseCanvasInfo$0 → KILLED

213

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_obscuresCorrectlyForNoChars()]
negated conditional → KILLED

215

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_obscuresCorrectlyForLessThanThreeCharacters()]
negated conditional → KILLED

2.2
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_obscuresCorrectlyForFourCharacters()]
changed conditional boundary → KILLED

218

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_returnsCorrectOutput()]
Replaced integer subtraction with addition → KILLED

219

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_returnsCorrectOutput()]
Replaced integer subtraction with addition → KILLED

222

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_obscuresCorrectlyForNoChars()]
replaced return value with Collections.emptyMap for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseCanvasInfo → KILLED

224

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_obscuresCorrectlyForNoChars()]
negated conditional → KILLED

225

1.1
Location : getCourseCanvasInfo
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCanvasInfo_obscuresCorrectlyForNoChars()]
negated conditional → KILLED

247

1.1
Location : linkCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testRedirect()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::linkCourse → KILLED

272

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testNoPerms()]
negated conditional → KILLED

273

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testNoPerms()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::addInstallation → KILLED

280

1.1
Location : lambda$addInstallation$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testCourseLinkNotFound()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$addInstallation$0 → KILLED

281

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testNotCreator()]
negated conditional → KILLED

282

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testNotCreator()]
negated conditional → KILLED

283

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testNotCreator()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::addInstallation → KILLED

286

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testCourseLinkSuccessWhenAdminNotCreator()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setInstallationId → KILLED

287

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testCourseLinkSuccessWhenAdminNotCreator()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setOrgName → KILLED

290

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testLinkCourseSuccessfully()]
removed call to java/util/List::forEach → KILLED

292

1.1
Location : lambda$addInstallation$1
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testLinkCourseSuccessfully()]
removed call to edu/ucsb/cs156/frontiers/entities/RosterStudent::setOrgStatus → KILLED

296

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testLinkCourseSuccessfully()]
removed call to java/util/List::forEach → KILLED

298

1.1
Location : lambda$addInstallation$2
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testLinkCourseSuccessfully()]
removed call to edu/ucsb/cs156/frontiers/entities/CourseStaff::setOrgStatus → KILLED

301

1.1
Location : addInstallation
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testCourseLinkSuccessWhenAdminNotCreator()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::addInstallation → KILLED

317

1.1
Location : handleInvalidInstallationType
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testNotOrganization()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::handleInvalidInstallationType → KILLED

344

1.1
Location : listCoursesForCurrentUser
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testListCoursesForCurrentUser()]
removed call to java/lang/Iterable::forEach → KILLED

345

1.1
Location : listCoursesForCurrentUser
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testListCoursesForCurrentUser()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::listCoursesForCurrentUser → KILLED

359

1.1
Location : lambda$listCoursesForCurrentUser$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testListCoursesForCurrentUser()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$listCoursesForCurrentUser$0 → KILLED

401

1.1
Location : staffCourses
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testStudenIsStaffInCourse()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/CoursesController::staffCourses → KILLED

415

1.1
Location : lambda$staffCourses$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testStudenIsStaffInCourse()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$staffCourses$0 → KILLED

432

1.1
Location : lambda$updateInstructorEmail$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testUpdateInstructorEmail_courseDoesNotExist()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$updateInstructorEmail$0 → KILLED

438

1.1
Location : updateInstructorEmail
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testUpdateInstructorEmail_emailNotFound()]
negated conditional → KILLED

2.2
Location : updateInstructorEmail
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testUpdateInstructorEmail_emailNotFound()]
negated conditional → KILLED

442

1.1
Location : updateInstructorEmail
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testUpdateInstructorEmail_byAdmin_email_is_admin()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setInstructorEmail → KILLED

445

1.1
Location : updateInstructorEmail
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:testUpdateInstructorEmail_byAdmin_email_is_instructor()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateInstructorEmail → KILLED

469

1.1
Location : lambda$getCourseEmails$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_students_excludes_dropped_students()]
replaced boolean return with true for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseEmails$0 → KILLED

2.2
Location : lambda$getCourseEmails$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_defaults_to_students_one_per_line()]
negated conditional → KILLED

470

1.1
Location : lambda$getCourseEmails$1
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_students_blank_team_is_unfiltered()]
negated conditional → KILLED

2.2
Location : lambda$getCourseEmails$1
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_students_filtered_by_team()]
replaced boolean return with true for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$getCourseEmails$1 → KILLED

3.3
Location : lambda$getCourseEmails$1
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_students_filtered_by_team()]
negated conditional → KILLED

4.4
Location : lambda$getCourseEmails$1
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_defaults_to_students_one_per_line()]
negated conditional → KILLED

477

1.1
Location : getCourseEmails
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_staff_only_sorted_lexicographically()]
negated conditional → KILLED

479

1.1
Location : getCourseEmails
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_all_comma_separated_staff_first()]
negated conditional → KILLED

484

1.1
Location : getCourseEmails
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_staff_only_sorted_lexicographically()]
negated conditional → KILLED

485

1.1
Location : getCourseEmails
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:getCourseEmails_staff_only_sorted_lexicographically()]
replaced return value with "" for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseEmails → KILLED

497

1.1
Location : lambda$deleteCourse$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_not_found_returns_not_found()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$deleteCourse$0 → KILLED

500

1.1
Location : deleteCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_success_returns_ok()]
negated conditional → KILLED

2.2
Location : deleteCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_success_returns_ok()]
negated conditional → KILLED

504

1.1
Location : deleteCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_success_returns_ok()]
removed call to edu/ucsb/cs156/frontiers/services/OrganizationLinkerService::unenrollOrganization → KILLED

505

1.1
Location : deleteCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_success_returns_ok()]
removed call to edu/ucsb/cs156/jobs/repositories/JobsRepository::deleteByScopeTypeAndScopeId → KILLED

506

1.1
Location : deleteCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_success_returns_ok()]
removed call to edu/ucsb/cs156/frontiers/repositories/CourseRepository::delete → KILLED

507

1.1
Location : deleteCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:delete_success_returns_ok()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::deleteCourse → KILLED

530

1.1
Location : lambda$updateCourse$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:update_course_not_found_returns_not_found()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$updateCourse$0 → KILLED

532

1.1
Location : updateCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:update_course_success_returns_ok()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setCourseName → KILLED

533

1.1
Location : updateCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:update_course_success_returns_ok()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setTerm → KILLED

534

1.1
Location : updateCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:update_course_success_returns_ok()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setSchool → KILLED

538

1.1
Location : updateCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourse_success_admin()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateCourse → KILLED

562

1.1
Location : lambda$updateCourseWithCanvasToken$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_not_found_returns_not_found()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$updateCourseWithCanvasToken$0 → KILLED

565

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_null_params_no_change()]
negated conditional → KILLED

566

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_encryptsBeforeSaving()]
negated conditional → KILLED

567

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_encryptsBeforeSaving()]
negated conditional → KILLED

568

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_encryptsBeforeSaving()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasApiToken → KILLED

571

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_null_params_no_change()]
negated conditional → KILLED

572

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:admin_can_updateCourseCanvasToken_created_by_someone_else()]
negated conditional → KILLED

573

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:admin_can_updateCourseCanvasToken_created_by_someone_else()]
negated conditional → KILLED

574

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:admin_can_updateCourseCanvasToken_created_by_someone_else()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasCourseId → KILLED

579

1.1
Location : updateCourseWithCanvasToken
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:updateCourseCanvasToken_success_admin()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateCourseWithCanvasToken → KILLED

589

1.1
Location : lambda$warnings$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:test_warnings_not_found()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$warnings$0 → KILLED

590

1.1
Location : warnings
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:calls_org_service_for_warnings()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::warnings → KILLED

600

1.1
Location : lambda$hideBasePermissionWarning$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:hideBasePermissionWarning_notFound()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$hideBasePermissionWarning$0 → KILLED

602

1.1
Location : hideBasePermissionWarning
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:hideBasePermissionWarning_setsFieldTrue()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setHideBasePermissionWarning → KILLED

605

1.1
Location : hideBasePermissionWarning
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:hideBasePermissionWarning_setsFieldTrue()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::hideBasePermissionWarning → KILLED

616

1.1
Location : lambda$hideFreePlanWarning$0
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:hideFreePlanWarning_notFound()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::lambda$hideFreePlanWarning$0 → KILLED

618

1.1
Location : hideFreePlanWarning
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:hideFreePlanWarning_setsFieldTrue()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setHideFreePlanWarning → KILLED

621

1.1
Location : hideFreePlanWarning
Killed by : edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.CoursesControllerTests]/[method:hideFreePlanWarning_setsFieldTrue()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::hideFreePlanWarning → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support