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
  /**
421
   * This method changes the instructor of a course (admin only). The new instructor is also added
422
   * as a staff member of the course, unless they are already on staff. The old instructor stays on
423
   * the staff list and can be kept or removed by hand.
424
   *
425
   * @param courseId the id of the course
426
   * @param instructorEmail the email of the new instructor (must be an instructor or admin)
427
   */
428
  @Operation(
429
      summary = "Update instructor email for a course (admin only)",
430
      description = "The new instructor is also added as a staff member of the course.")
431
  @PreAuthorize("hasRole('ROLE_ADMIN')")
432
  @PutMapping("/updateInstructor")
433
  public InstructorCourseView updateInstructorEmail(
434
      @Parameter(name = "courseId") @RequestParam Long courseId,
435
      @Parameter(name = "instructorEmail") @RequestParam String instructorEmail) {
436
437
    instructorEmail = instructorEmail.strip();
438
439
    Course course =
440
        courseRepository
441
            .findById(courseId)
442 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));
443
444
    // Validate that the email exists in either instructor or admin table
445
    boolean isInstructor = instructorRepository.existsByEmail(instructorEmail);
446
    boolean isAdmin = adminRepository.existsByEmail(instructorEmail);
447
448 2 1. updateInstructorEmail : negated conditional → KILLED
2. updateInstructorEmail : negated conditional → KILLED
    if (!isInstructor && !isAdmin) {
449
      throw new IllegalArgumentException("Email must belong to either an instructor or admin");
450
    }
451
452 1 1. updateInstructorEmail : removed call to edu/ucsb/cs156/frontiers/entities/Course::setInstructorEmail → KILLED
    course.setInstructorEmail(instructorEmail);
453
    Course savedCourse = courseRepository.save(course);
454 1 1. updateInstructorEmail : removed call to edu/ucsb/cs156/frontiers/services/CourseStaffService::ensureInstructorIsStaff → KILLED
    courseStaffService.ensureInstructorIsStaff(savedCourse);
455
456 1 1. updateInstructorEmail : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateInstructorEmail → KILLED
    return new InstructorCourseView(savedCourse);
457
  }
458
459
  @Operation(summary = "Get course emails")
460
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
461
  @GetMapping("/emails")
462
  @AllowApiKeyAccess
463
  public String getCourseEmails(
464
      @Parameter(name = "courseId") @RequestParam Long courseId,
465
      @Parameter(name = "type") @RequestParam(defaultValue = "STUDENTS") EmailTypes type,
466
      @Parameter(name = "team") @RequestParam(required = false) String team,
467
      @Parameter(name = "format") @RequestParam(defaultValue = "ONE_PER_LINE")
468
          EmailFormats format) {
469
470
    List<String> staffEmails =
471
        StreamSupport.stream(courseStaffRepository.findByCourseId(courseId).spliterator(), false)
472
            .map(CourseStaff::getEmail)
473
            .filter(Objects::nonNull)
474
            .sorted()
475
            .collect(Collectors.toList());
476
477
    // Dropped students are not part of the current roster, so they are never included
478
    List<String> studentEmails =
479
        StreamSupport.stream(rosterStudentRepository.findByCourseId(courseId).spliterator(), false)
480 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)
481 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))
482
            .map(RosterStudent::getEmail)
483
            .filter(Objects::nonNull)
484
            .sorted()
485
            .collect(Collectors.toList());
486
487
    List<String> emails = studentEmails;
488 1 1. getCourseEmails : negated conditional → KILLED
    if (type == EmailTypes.STAFF) {
489
      emails = staffEmails;
490 1 1. getCourseEmails : negated conditional → KILLED
    } else if (type == EmailTypes.ALL) {
491
      emails = new ArrayList<>(staffEmails);
492
      emails.addAll(studentEmails);
493
    }
494
495 1 1. getCourseEmails : negated conditional → KILLED
    String separator = format == EmailFormats.COMMA_SEPARATED ? "," : "\r\n";
496 1 1. getCourseEmails : replaced return value with "" for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseEmails → KILLED
    return String.join(separator, emails);
497
  }
498
499
  @Operation(summary = "Delete a course")
500
  @PreAuthorize("hasRole('ROLE_ADMIN')")
501
  @DeleteMapping("")
502
  @Transactional
503
  public Object deleteCourse(@RequestParam Long courseId)
504
      throws NoSuchAlgorithmException, InvalidKeySpecException {
505
    Course course =
506
        courseRepository
507
            .findById(courseId)
508 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));
509
510
    // Check if course has roster students or staff
511 2 1. deleteCourse : negated conditional → KILLED
2. deleteCourse : negated conditional → KILLED
    if (!course.getRosterStudents().isEmpty() || !course.getCourseStaff().isEmpty()) {
512
      throw new IllegalArgumentException("Cannot delete course with students or staff");
513
    }
514
515 1 1. deleteCourse : removed call to edu/ucsb/cs156/frontiers/services/OrganizationLinkerService::unenrollOrganization → KILLED
    linkerService.unenrollOrganization(course);
516 1 1. deleteCourse : removed call to edu/ucsb/cs156/jobs/repositories/JobsRepository::deleteByScopeTypeAndScopeId → KILLED
    jobsRepository.deleteByScopeTypeAndScopeId("course", courseId);
517 1 1. deleteCourse : removed call to edu/ucsb/cs156/frontiers/repositories/CourseRepository::delete → KILLED
    courseRepository.delete(course);
518 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()));
519
  }
520
521
  /**
522
   * This method updates an existing course.
523
   *
524
   * @param courseId the id of the course to update
525
   * @param courseName the new name of the course
526
   * @param term the new term of the course
527
   * @param school the new school of the course
528
   * @return the updated course
529
   */
530
  @Operation(summary = "Update an existing course")
531
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
532
  @PutMapping("")
533
  public InstructorCourseView updateCourse(
534
      @Parameter(name = "courseId") @RequestParam Long courseId,
535
      @Parameter(name = "courseName") @RequestParam String courseName,
536
      @Parameter(name = "term") @RequestParam String term,
537
      @Parameter(name = "school") @RequestParam School school) {
538
    Course course =
539
        courseRepository
540
            .findById(courseId)
541 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));
542
543 1 1. updateCourse : removed call to edu/ucsb/cs156/frontiers/entities/Course::setCourseName → KILLED
    course.setCourseName(courseName);
544 1 1. updateCourse : removed call to edu/ucsb/cs156/frontiers/entities/Course::setTerm → KILLED
    course.setTerm(term);
545 1 1. updateCourse : removed call to edu/ucsb/cs156/frontiers/entities/Course::setSchool → KILLED
    course.setSchool(school);
546
547
    Course savedCourse = courseRepository.save(course);
548
549 1 1. updateCourse : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateCourse → KILLED
    return new InstructorCourseView(savedCourse);
550
  }
551
552
  /**
553
   * This method updates an existing course.
554
   *
555
   * @param courseId the id of the course to update
556
   * @param courseName the new name of the course
557
   * @param term the new term of the course
558
   * @param school the new school of the course
559
   * @param canvasApiToken the new Canvas API token for the course
560
   * @param canvasCourseId the new Canvas course ID
561
   * @return the updated course
562
   */
563
  @Operation(summary = "Update an existing course with Canvas token and course ID")
564
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
565
  @PutMapping("/updateCourseCanvasToken")
566
  public InstructorCourseView updateCourseWithCanvasToken(
567
      @Parameter(name = "courseId") @RequestParam Long courseId,
568
      @Parameter(name = "canvasApiToken") @RequestParam(required = false) String canvasApiToken,
569
      @Parameter(name = "canvasCourseId") @RequestParam(required = false) String canvasCourseId) {
570
    Course course =
571
        courseRepository
572
            .findById(courseId)
573 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));
574
575
    String existingCanvasToken = canvasApiTokenSecurityService.decrypt(course.getCanvasApiToken());
576 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
    if (canvasApiToken != null
577 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasApiToken.isEmpty()
578 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasApiToken.equals(existingCanvasToken)) {
579 1 1. updateCourseWithCanvasToken : removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasApiToken → KILLED
      course.setCanvasApiToken(canvasApiTokenSecurityService.encrypt(canvasApiToken));
580
    }
581
582 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
    if (canvasCourseId != null
583 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasCourseId.isEmpty()
584 1 1. updateCourseWithCanvasToken : negated conditional → KILLED
        && !canvasCourseId.equals(course.getCanvasCourseId())) {
585 1 1. updateCourseWithCanvasToken : removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasCourseId → KILLED
      course.setCanvasCourseId(canvasCourseId);
586
    }
587
588
    Course savedCourse = courseRepository.save(course);
589
590 1 1. updateCourseWithCanvasToken : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateCourseWithCanvasToken → KILLED
    return new InstructorCourseView(savedCourse);
591
  }
592
593
  @Operation(summary = "Get course warnings")
594
  @GetMapping("/warnings/{courseId}")
595
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
596
  public CourseWarning warnings(@PathVariable @Parameter Long courseId) throws Exception {
597
    Course course =
598
        courseRepository
599
            .findById(courseId)
600 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));
601 1 1. warnings : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::warnings → KILLED
    return linkerService.checkCourseWarnings(course);
602
  }
603
604
  @Operation(summary = "Hide base permission warning for a course")
605
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
606
  @PostMapping("/warnings/hideBasePermissionWarning/{courseId}")
607
  public Object hideBasePermissionWarning(@PathVariable @Parameter Long courseId) {
608
    Course course =
609
        courseRepository
610
            .findById(courseId)
611 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));
612
613 1 1. hideBasePermissionWarning : removed call to edu/ucsb/cs156/frontiers/entities/Course::setHideBasePermissionWarning → KILLED
    course.setHideBasePermissionWarning(true);
614
    courseRepository.save(course);
615
616 1 1. hideBasePermissionWarning : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::hideBasePermissionWarning → KILLED
    return genericMessage(
617
        "hideBasePermissionWarning set to true for course with id %s".formatted(courseId));
618
  }
619
620
  @Operation(summary = "Hide free plan warning for a course")
621
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
622
  @PostMapping("/warnings/hideFreePlanWarning/{courseId}")
623
  public Object hideFreePlanWarning(@PathVariable @Parameter Long courseId) {
624
    Course course =
625
        courseRepository
626
            .findById(courseId)
627 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));
628
629 1 1. hideFreePlanWarning : removed call to edu/ucsb/cs156/frontiers/entities/Course::setHideFreePlanWarning → KILLED
    course.setHideFreePlanWarning(true);
630
    courseRepository.save(course);
631
632 1 1. hideFreePlanWarning : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::hideFreePlanWarning → KILLED
    return genericMessage(
633
        "hideFreePlanWarning set to true for course with id %s".formatted(courseId));
634
  }
635
}

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_obscuresCorrectlyForThreeCharacters()]
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_obscuresCorrectlyForThreeCharacters()]
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_obscuresCorrectlyForThreeCharacters()]
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_obscuresCorrectlyForThreeCharacters()]
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

442

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

448

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

452

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

454

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()]
removed call to edu/ucsb/cs156/frontiers/services/CourseStaffService::ensureInstructorIsStaff → KILLED

456

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

480

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

481

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

488

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

490

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

495

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

496

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

508

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

511

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

515

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

516

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

517

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

518

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

541

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

543

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

544

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

545

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

549

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

573

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

576

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

577

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

578

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

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_encryptsBeforeSaving()]
removed call to edu/ucsb/cs156/frontiers/entities/Course::setCanvasApiToken → KILLED

582

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

583

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

584

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

585

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

590

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

600

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

601

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

611

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

613

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

616

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

627

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

629

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

632

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