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

Mutations

101

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

130

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

131

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

150

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

166

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

181

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

184

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

204

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

208

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

210

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

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

214

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

217

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()]
replaced return value with Collections.emptyMap for edu/ucsb/cs156/frontiers/controllers/CoursesController::getCourseCanvasInfo → 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_obscuresCorrectlyForLessThanThreeCharacters()]
negated conditional → 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_obscuresCorrectlyForLessThanThreeCharacters()]
negated conditional → KILLED

242

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

267

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

268

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

275

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

276

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

277

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

278

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

281

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

282

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

285

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

287

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

291

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

293

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

296

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

312

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

339

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

340

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

354

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

396

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

410

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

427

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

433

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

437

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

440

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

464

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

465

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

472

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

474

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

479

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

480

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

492

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

495

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

499

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

500

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

501

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

502

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

525

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

527

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

528

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

529

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

533

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

557

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

560

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

561

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

562

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

563

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

566

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

567

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

568

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

569

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

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

584

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

585

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

595

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

597

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

600

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

611

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

613

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

616

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