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

Mutations

113

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

142

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

143

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

162

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

178

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

193

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

196

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

216

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

220

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

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_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

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_returnsCorrectOutput()]
Replaced integer subtraction with addition → KILLED

226

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

229

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

231

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

232

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

254

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

279

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

280

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

287

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

288

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

289

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

290

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

293

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

294

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

297

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

299

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

303

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

305

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

308

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

324

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

351

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

352

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

366

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

408

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

422

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

439

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

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_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

449

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

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_instructor()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/CoursesController::updateInstructorEmail → KILLED

476

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

477

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

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

486

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

491

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

492

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

504

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

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

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

512

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

513

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

514

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

537

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

539

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

540

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

541

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

545

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

569

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

572

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

573

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

574

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

575

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

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

580

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

581

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

586

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

596

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

597

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

607

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

609

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

612

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

623

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

625

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

628

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