CreateTeamRepositoriesJob.java

1
package edu.ucsb.cs156.frontiers.jobs;
2
3
import edu.ucsb.cs156.frontiers.entities.Course;
4
import edu.ucsb.cs156.frontiers.entities.Team;
5
import edu.ucsb.cs156.frontiers.enums.RepositoryPermissions;
6
import edu.ucsb.cs156.frontiers.services.GithubTeamService;
7
import edu.ucsb.cs156.frontiers.services.RepositoryService;
8
import edu.ucsb.cs156.frontiers.services.jobs.JobContext;
9
import edu.ucsb.cs156.frontiers.services.jobs.JobContextConsumer;
10
import lombok.Builder;
11
12
@Builder
13
public class CreateTeamRepositoriesJob implements JobContextConsumer {
14
  Course course;
15
  RepositoryService repositoryService;
16
  GithubTeamService githubTeamService;
17
  String repositoryPrefix;
18
  Boolean isPrivate;
19
  RepositoryPermissions permissions;
20
  String teamRegex;
21
22
  @Override
23
  public Course getCourse() {
24 1 1. getCourse : replaced return value with null for edu/ucsb/cs156/frontiers/jobs/CreateTeamRepositoriesJob::getCourse → KILLED
    return course;
25
  }
26
27
  @Override
28
  public void accept(JobContext ctx) throws Exception {
29
    ctx.log("Creating team repositories...");
30
31
    Integer orgId;
32
    try {
33
      orgId = githubTeamService.getOrgId(course.getOrgName(), course);
34
    } catch (Exception e) {
35
      throw new IllegalStateException(
36
          "Failed to get organization ID for org: " + course.getOrgName() + " - " + e.getMessage(),
37
          e);
38
    }
39
40
    for (Team team : course.getTeams()) {
41 2 1. accept : negated conditional → KILLED
2. accept : negated conditional → KILLED
      if (teamRegex != null && !team.getName().matches(teamRegex)) {
42
        continue;
43
      }
44 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createTeamRepository → KILLED
      repositoryService.createTeamRepository(
45
          course, team, repositoryPrefix, isPrivate, permissions, orgId);
46
    }
47
    ctx.log("Done");
48
  }
49
}

Mutations

24

1.1
Location : getCourse
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest]/[method:test_getCourse_returnsCourse()]
replaced return value with null for edu/ucsb/cs156/frontiers/jobs/CreateTeamRepositoriesJob::getCourse → KILLED

41

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest]/[method:testCreateTeamRepository_withRegex_noMatches()]
negated conditional → KILLED

2.2
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest]/[method:testCreateTeamRepository_withRegex_noMatches()]
negated conditional → KILLED

44

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateTeamRepositoriesJobTest]/[method:testCreateTeamRepository_withRegex_onlyMatchingTeams()]
removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createTeamRepository → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0