AssignmentsController.java

1
package edu.ucsb.cs156.frontiers.controllers;
2
3
import edu.ucsb.cs156.frontiers.entities.Assignment;
4
import edu.ucsb.cs156.frontiers.entities.Course;
5
import edu.ucsb.cs156.frontiers.enums.AssignmentType;
6
import edu.ucsb.cs156.frontiers.enums.Permission;
7
import edu.ucsb.cs156.frontiers.enums.RepositoryCreationOption;
8
import edu.ucsb.cs156.frontiers.enums.RepositoryPermissions;
9
import edu.ucsb.cs156.frontiers.enums.Visibility;
10
import edu.ucsb.cs156.frontiers.errors.EntityNotFoundException;
11
import edu.ucsb.cs156.frontiers.errors.NoLinkedOrganizationException;
12
import edu.ucsb.cs156.frontiers.jobs.CreateStudentOrStaffRepositoriesJob;
13
import edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJob;
14
import edu.ucsb.cs156.frontiers.models.AssignmentWithJob;
15
import edu.ucsb.cs156.frontiers.repositories.AssignmentRepository;
16
import edu.ucsb.cs156.frontiers.repositories.CourseRepository;
17
import edu.ucsb.cs156.frontiers.services.GithubTeamService;
18
import edu.ucsb.cs156.frontiers.services.RepositoryService;
19
import edu.ucsb.cs156.jobs.entities.Job;
20
import edu.ucsb.cs156.jobs.services.JobService;
21
import io.swagger.v3.oas.annotations.Operation;
22
import io.swagger.v3.oas.annotations.Parameter;
23
import io.swagger.v3.oas.annotations.tags.Tag;
24
import java.util.List;
25
import java.util.regex.Pattern;
26
import java.util.regex.PatternSyntaxException;
27
import lombok.extern.slf4j.Slf4j;
28
import org.springframework.beans.factory.annotation.Autowired;
29
import org.springframework.security.access.prepost.PreAuthorize;
30
import org.springframework.web.bind.annotation.DeleteMapping;
31
import org.springframework.web.bind.annotation.GetMapping;
32
import org.springframework.web.bind.annotation.PathVariable;
33
import org.springframework.web.bind.annotation.PostMapping;
34
import org.springframework.web.bind.annotation.PutMapping;
35
import org.springframework.web.bind.annotation.RequestMapping;
36
import org.springframework.web.bind.annotation.RequestParam;
37
import org.springframework.web.bind.annotation.RestController;
38
39
/**
40
 * Assignments of a course, and the jobs that create their repositories. Creating or editing an
41
 * assignment saves it and starts the job that creates its individual or team repositories, and the
42
 * id of that job is kept as the assignment's last job id.
43
 */
44
@Tag(name = "Assignments")
45
@RequestMapping("/api/assignments")
46
@RestController
47
@Slf4j
48
public class AssignmentsController extends ApiController {
49
50
  /** The team regular expression that matches every team. */
51
  public static final String DEFAULT_TEAM_REGEX = ".*";
52
53
  @Autowired private AssignmentRepository assignmentRepository;
54
55
  @Autowired private CourseRepository courseRepository;
56
57
  @Autowired private RepositoryService repositoryService;
58
59
  @Autowired private GithubTeamService githubTeamService;
60
61
  @Autowired private JobService jobService;
62
63
  /**
64
   * Lists the assignments of a course, sorted by repository prefix.
65
   *
66
   * @param courseId the ID of the course
67
   * @return the assignments of the course
68
   */
69
  @Operation(summary = "List the assignments of a course")
70
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
71
  @GetMapping("")
72
  public List<Assignment> getAssignments(@Parameter(name = "courseId") @RequestParam Long courseId)
73
      throws EntityNotFoundException {
74
    ensureCourseExists(courseId);
75 1 1. getAssignments : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::getAssignments → KILLED
    return assignmentRepository.findByCourseIdOrderByRepoPrefixAsc(courseId);
76
  }
77
78
  /**
79
   * Creates an assignment and starts the job that creates its repositories.
80
   *
81
   * <p>For an INDIVIDUAL assignment, createReposFor says whom repositories are created for (default
82
   * STUDENTS_ONLY) and teamRegex must not be given. For a TEAM assignment, teamRegex is the regular
83
   * expression that team names must match (default {@value #DEFAULT_TEAM_REGEX}, every team) and
84
   * createReposFor must not be given.
85
   *
86
   * @param courseId the ID of the course the assignment is for
87
   * @param repoPrefix each repository created begins with this prefix
88
   * @param asnType the assignment type (individual vs team)
89
   * @param visibility the visibility of the repositories (public vs private)
90
   * @param permission the permission that students, or teams, have on the repositories
91
   * @param createReposFor INDIVIDUAL only: whom to create repositories for
92
   * @param teamRegex TEAM only: only teams whose names match get a repository
93
   * @param requireSignedCommit whether the repositories must require signed commits (default false)
94
   * @param restrictPrsToContributors TEAM only: whether pull requests are restricted to users with
95
   *     Write access (default false)
96
   * @return the created assignment, with the id of the job as its last job id, and that job
97
   */
98
  @Operation(summary = "Create an assignment and start creating its repositories")
99
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
100
  @PostMapping("/post")
101
  public AssignmentWithJob postAssignment(
102
      @Parameter(name = "courseId") @RequestParam Long courseId,
103
      @Parameter(name = "repoPrefix") @RequestParam String repoPrefix,
104
      @Parameter(name = "asnType") @RequestParam AssignmentType asnType,
105
      @Parameter(name = "visibility") @RequestParam Visibility visibility,
106
      @Parameter(name = "permission") @RequestParam Permission permission,
107
      @Parameter(name = "createReposFor") @RequestParam(required = false)
108
          RepositoryCreationOption createReposFor,
109
      @Parameter(name = "teamRegex") @RequestParam(required = false) String teamRegex,
110
      @Parameter(name = "requireSignedCommit") @RequestParam(required = false)
111
          Boolean requireSignedCommit,
112
      @Parameter(name = "restrictPrsToContributors") @RequestParam(required = false)
113
          Boolean restrictPrsToContributors)
114
      throws EntityNotFoundException {
115
    Course course = ensureCourseExists(courseId);
116
    Assignment assignment = Assignment.builder().course(course).asnType(asnType).build();
117 1 1. postAssignment : removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::applyFields → KILLED
    applyFields(
118
        assignment,
119
        repoPrefix,
120
        visibility,
121
        permission,
122
        createReposFor,
123
        teamRegex,
124
        requireSignedCommit,
125
        restrictPrsToContributors);
126 1 1. postAssignment : removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::requireLinkedOrganization → KILLED
    requireLinkedOrganization(course);
127
128 1 1. postAssignment : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::postAssignment → KILLED
    return launchAndSave(course, assignment);
129
  }
130
131
  /**
132
   * Updates an assignment and starts the job that creates its repositories. The assignment type
133
   * cannot be changed: to change an individual assignment to a team one, or the other way round,
134
   * delete the assignment and create a new one. The same rules as for creating apply to
135
   * createReposFor and teamRegex, according to the assignment's type.
136
   *
137
   * @param courseId the ID of the course the assignment belongs to
138
   * @param assignmentId the ID of the assignment
139
   * @param repoPrefix each repository created begins with this prefix
140
   * @param visibility the visibility of the repositories (public vs private)
141
   * @param permission the permission that students, or teams, have on the repositories
142
   * @param createReposFor INDIVIDUAL only: whom to create repositories for
143
   * @param teamRegex TEAM only: only teams whose names match get a repository
144
   * @param requireSignedCommit whether the repositories must require signed commits; if it is not
145
   *     given the assignment keeps its setting
146
   * @param restrictPrsToContributors TEAM only: whether pull requests are restricted to users with
147
   *     Write access; if it is not given the assignment keeps its setting
148
   * @return the updated assignment, with the id of the job as its last job id, and that job
149
   */
150
  @Operation(summary = "Update an assignment and start creating its repositories")
151
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
152
  @PutMapping("/put")
153
  public AssignmentWithJob updateAssignment(
154
      @Parameter(name = "courseId") @RequestParam Long courseId,
155
      @Parameter(name = "assignmentId") @RequestParam Long assignmentId,
156
      @Parameter(name = "repoPrefix") @RequestParam String repoPrefix,
157
      @Parameter(name = "visibility") @RequestParam Visibility visibility,
158
      @Parameter(name = "permission") @RequestParam Permission permission,
159
      @Parameter(name = "createReposFor") @RequestParam(required = false)
160
          RepositoryCreationOption createReposFor,
161
      @Parameter(name = "teamRegex") @RequestParam(required = false) String teamRegex,
162
      @Parameter(name = "requireSignedCommit") @RequestParam(required = false)
163
          Boolean requireSignedCommit,
164
      @Parameter(name = "restrictPrsToContributors") @RequestParam(required = false)
165
          Boolean restrictPrsToContributors)
166
      throws EntityNotFoundException {
167
    Course course = ensureCourseExists(courseId);
168
    Assignment assignment = findAssignmentInCourse(courseId, assignmentId);
169 1 1. updateAssignment : removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::applyFields → KILLED
    applyFields(
170
        assignment,
171
        repoPrefix,
172
        visibility,
173
        permission,
174
        createReposFor,
175
        teamRegex,
176
        requireSignedCommit,
177
        restrictPrsToContributors);
178 1 1. updateAssignment : removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::requireLinkedOrganization → KILLED
    requireLinkedOrganization(course);
179
180 1 1. updateAssignment : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::updateAssignment → KILLED
    return launchAndSave(course, assignment);
181
  }
182
183
  /**
184
   * Starts the job that creates the repositories of an existing assignment again, for example to
185
   * pick up students who have joined since the last run, and records it as the assignment's last
186
   * job.
187
   *
188
   * @param courseId the ID of the course the assignment belongs to
189
   * @param assignmentId the ID of the assignment
190
   * @return the assignment, with its new last job id, and the job that was started
191
   */
192
  @Operation(summary = "Start creating the repositories of an assignment")
193
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
194
  @PostMapping("/launch")
195
  public AssignmentWithJob launchAssignmentJob(
196
      @Parameter(name = "courseId") @RequestParam Long courseId,
197
      @Parameter(name = "assignmentId") @RequestParam Long assignmentId)
198
      throws EntityNotFoundException {
199
    Course course = ensureCourseExists(courseId);
200
    Assignment assignment = findAssignmentInCourse(courseId, assignmentId);
201 1 1. launchAssignmentJob : removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::requireLinkedOrganization → KILLED
    requireLinkedOrganization(course);
202
203 1 1. launchAssignmentJob : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchAssignmentJob → KILLED
    return launchAndSave(course, assignment);
204
  }
205
206
  @Operation(summary = "Delete an assignment")
207
  @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)")
208
  @DeleteMapping("/{id}")
209
  public Object deleteAssignment(
210
      @Parameter(name = "id") @PathVariable Long id,
211
      @Parameter(name = "courseId") @RequestParam Long courseId) {
212
    ensureCourseExists(courseId);
213
    Assignment assignment = findAssignmentInCourse(courseId, id);
214
215 1 1. deleteAssignment : removed call to edu/ucsb/cs156/frontiers/repositories/AssignmentRepository::delete → KILLED
    assignmentRepository.delete(assignment);
216
217 1 1. deleteAssignment : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::deleteAssignment → KILLED
    return genericMessage(String.format("Assignment with id %s deleted", id));
218
  }
219
220
  private Course ensureCourseExists(Long courseId) {
221 1 1. ensureCourseExists : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::ensureCourseExists → KILLED
    return courseRepository
222
        .findById(courseId)
223 1 1. lambda$ensureCourseExists$0 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::lambda$ensureCourseExists$0 → KILLED
        .orElseThrow(() -> new EntityNotFoundException(Course.class, courseId));
224
  }
225
226
  /** Finds an assignment, which must belong to the given course. */
227
  private Assignment findAssignmentInCourse(Long courseId, Long assignmentId) {
228 1 1. findAssignmentInCourse : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::findAssignmentInCourse → KILLED
    return assignmentRepository
229
        .findById(assignmentId)
230 2 1. lambda$findAssignmentInCourse$0 : replaced boolean return with true for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::lambda$findAssignmentInCourse$0 → KILLED
2. lambda$findAssignmentInCourse$0 : replaced boolean return with false for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::lambda$findAssignmentInCourse$0 → KILLED
        .filter(a -> a.getCourse().getId().equals(courseId))
231 1 1. lambda$findAssignmentInCourse$1 : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::lambda$findAssignmentInCourse$1 → KILLED
        .orElseThrow(() -> new EntityNotFoundException(Assignment.class, assignmentId));
232
  }
233
234
  /**
235
   * Starts the job that creates the assignment's repositories and saves the assignment with the id
236
   * of that job as its last job id.
237
   */
238
  private AssignmentWithJob launchAndSave(Course course, Assignment assignment) {
239
    Job job = launchJob(course, assignment);
240 1 1. launchAndSave : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setLastJobId → KILLED
    assignment.setLastJobId(job.getId());
241 1 1. launchAndSave : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchAndSave → KILLED
    return new AssignmentWithJob(assignmentRepository.save(assignment), job);
242
  }
243
244
  private static void requireLinkedOrganization(Course course) {
245 2 1. requireLinkedOrganization : negated conditional → KILLED
2. requireLinkedOrganization : negated conditional → KILLED
    if (course.getOrgName() == null || course.getInstallationId() == null) {
246
      throw new NoLinkedOrganizationException(course.getCourseName());
247
    }
248
  }
249
250
  /**
251
   * Sets the editable fields of an assignment, checking the ones that depend on its type.
252
   *
253
   * @throws IllegalArgumentException if a field is blank, does not apply to the type of the
254
   *     assignment, or is not a valid regular expression
255
   */
256
  private static void applyFields(
257
      Assignment assignment,
258
      String repoPrefix,
259
      Visibility visibility,
260
      Permission permission,
261
      RepositoryCreationOption createReposFor,
262
      String teamRegex,
263
      Boolean requireSignedCommit,
264
      Boolean restrictPrsToContributors) {
265
    String normalizedPrefix = repoPrefix.strip();
266 1 1. applyFields : negated conditional → KILLED
    if (normalizedPrefix.isEmpty()) {
267
      throw new IllegalArgumentException("repoPrefix must not be blank");
268
    }
269 2 1. applyFields : negated conditional → KILLED
2. applyFields : negated conditional → KILLED
    boolean hasTeamRegex = teamRegex != null && !teamRegex.isBlank();
270
271 1 1. applyFields : negated conditional → KILLED
    if (assignment.getAsnType() == AssignmentType.TEAM) {
272 1 1. applyFields : negated conditional → KILLED
      if (createReposFor != null) {
273
        throw new IllegalArgumentException(
274
            "createReposFor is only allowed for INDIVIDUAL assignments");
275
      }
276 1 1. applyFields : negated conditional → KILLED
      String regex = hasTeamRegex ? teamRegex : DEFAULT_TEAM_REGEX;
277
      try {
278
        Pattern.compile(regex);
279
      } catch (PatternSyntaxException e) {
280
        throw new IllegalArgumentException("teamRegex is not a valid regular expression", e);
281
      }
282 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setCreateReposFor → KILLED
      assignment.setCreateReposFor(null);
283 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setTeamRegex → KILLED
      assignment.setTeamRegex(regex);
284
    } else {
285 1 1. applyFields : negated conditional → KILLED
      if (hasTeamRegex) {
286
        throw new IllegalArgumentException("teamRegex is only allowed for TEAM assignments");
287
      }
288 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setCreateReposFor → KILLED
      assignment.setCreateReposFor(
289 1 1. applyFields : negated conditional → KILLED
          createReposFor == null ? RepositoryCreationOption.STUDENTS_ONLY : createReposFor);
290 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setTeamRegex → KILLED
      assignment.setTeamRegex(null);
291
    }
292
293 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setRepoPrefix → KILLED
    assignment.setRepoPrefix(normalizedPrefix);
294 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setVisibility → KILLED
    assignment.setVisibility(visibility);
295 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setPermission → KILLED
    assignment.setPermission(permission);
296 1 1. applyFields : negated conditional → KILLED
    if (requireSignedCommit != null) {
297 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setRequireSignedCommit → KILLED
      assignment.setRequireSignedCommit(requireSignedCommit);
298
    }
299 1 1. applyFields : negated conditional → KILLED
    if (restrictPrsToContributors != null) {
300 1 1. applyFields : removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setRestrictPrsToContributors → KILLED
      assignment.setRestrictPrsToContributors(restrictPrsToContributors);
301
    }
302
  }
303
304
  /** Starts the job that creates the individual or team repositories of an assignment. */
305
  private Job launchJob(Course course, Assignment assignment) {
306 1 1. launchJob : negated conditional → KILLED
    boolean isPrivate = assignment.getVisibility() == Visibility.PRIVATE;
307
    RepositoryPermissions permissions =
308
        RepositoryPermissions.valueOf(assignment.getPermission().name());
309 1 1. launchJob : negated conditional → KILLED
    if (assignment.getAsnType() == AssignmentType.TEAM) {
310 1 1. launchJob : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchJob → KILLED
      return jobService.runAsJob(
311
          CreateTeamRepositoriesJob.builder()
312
              .repositoryPrefix(assignment.getRepoPrefix())
313
              .isPrivate(isPrivate)
314
              .repositoryService(repositoryService)
315
              .githubTeamService(githubTeamService)
316
              .course(course)
317
              .permissions(permissions)
318
              .teamRegex(assignment.getTeamRegex())
319
              .requireSignedCommit(assignment.getRequireSignedCommit())
320
              .restrictPrsToContributors(assignment.getRestrictPrsToContributors())
321
              .build());
322
    }
323 1 1. launchJob : replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchJob → KILLED
    return jobService.runAsJob(
324
        CreateStudentOrStaffRepositoriesJob.builder()
325
            .repositoryPrefix(assignment.getRepoPrefix())
326
            .isPrivate(isPrivate)
327
            .repositoryService(repositoryService)
328
            .course(course)
329
            .permissions(permissions)
330
            .creationOption(assignment.getCreateReposFor())
331
            .requireSignedCommit(assignment.getRequireSignedCommit())
332
            .build());
333
  }
334
}

Mutations

75

1.1
Location : getAssignments
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:get_lists_the_assignments_of_the_course()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::getAssignments → KILLED

117

1.1
Location : postAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_returns_400_for_a_blank_repo_prefix()]
removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::applyFields → KILLED

126

1.1
Location : postAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_returns_400_when_the_course_has_no_linked_organization()]
removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::requireLinkedOrganization → KILLED

128

1.1
Location : postAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_can_require_signed_commits()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::postAssignment → KILLED

169

1.1
Location : updateAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:put_without_a_team_regex_resets_a_team_assignment_to_every_team()]
removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::applyFields → KILLED

178

1.1
Location : updateAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:put_returns_400_when_the_course_has_no_linked_organization()]
removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::requireLinkedOrganization → KILLED

180

1.1
Location : updateAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:put_updates_an_individual_assignment_and_starts_the_student_repo_job()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::updateAssignment → KILLED

201

1.1
Location : launchAssignmentJob
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:launch_returns_400_when_the_course_has_no_linked_organization()]
removed call to edu/ucsb/cs156/frontiers/controllers/AssignmentsController::requireLinkedOrganization → KILLED

203

1.1
Location : launchAssignmentJob
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:launch_starts_the_student_repo_job_of_an_individual_assignment()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchAssignmentJob → KILLED

215

1.1
Location : deleteAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:delete_removes_the_assignment()]
removed call to edu/ucsb/cs156/frontiers/repositories/AssignmentRepository::delete → KILLED

217

1.1
Location : deleteAssignment
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:delete_removes_the_assignment()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::deleteAssignment → KILLED

221

1.1
Location : ensureCourseExists
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_returns_400_when_the_course_has_no_linked_organization()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::ensureCourseExists → KILLED

223

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

228

1.1
Location : findAssignmentInCourse
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:delete_removes_the_assignment()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::findAssignmentInCourse → KILLED

230

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

2.2
Location : lambda$findAssignmentInCourse$0
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:delete_removes_the_assignment()]
replaced boolean return with false for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::lambda$findAssignmentInCourse$0 → KILLED

231

1.1
Location : lambda$findAssignmentInCourse$1
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:launch_returns_404_when_assignment_does_not_exist()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::lambda$findAssignmentInCourse$1 → KILLED

240

1.1
Location : launchAndSave
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:launch_starts_the_student_repo_job_of_an_individual_assignment()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setLastJobId → KILLED

241

1.1
Location : launchAndSave
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_can_require_signed_commits()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchAndSave → KILLED

245

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

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

266

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

269

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

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

271

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

272

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

276

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

282

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:put_clears_the_field_that_does_not_apply_to_the_type_of_the_assignment()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setCreateReposFor → KILLED

283

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_team_assignment_without_a_team_regex_matches_every_team()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setTeamRegex → KILLED

285

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

288

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_uses_the_given_options()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setCreateReposFor → KILLED

289

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

290

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:put_clears_the_field_that_does_not_apply_to_the_type_of_the_assignment()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setTeamRegex → KILLED

293

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_saves_it_and_starts_the_student_repo_job()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setRepoPrefix → KILLED

294

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_uses_the_given_options()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setVisibility → KILLED

295

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_uses_the_given_options()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setPermission → KILLED

296

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

297

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_can_require_signed_commits()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setRequireSignedCommit → KILLED

299

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

300

1.1
Location : applyFields
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_team_assignment_can_restrict_prs_to_contributors()]
removed call to edu/ucsb/cs156/frontiers/entities/Assignment::setRestrictPrsToContributors → KILLED

306

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

309

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

310

1.1
Location : launchJob
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:launch_gives_the_team_job_the_restrictPrsToContributors_the_assignment_has()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchJob → KILLED

323

1.1
Location : launchJob
Killed by : edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.AssignmentsControllerTests]/[method:post_individual_assignment_uses_the_given_options()]
replaced return value with null for edu/ucsb/cs156/frontiers/controllers/AssignmentsController::launchJob → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support