DeleteTeamFromGithubJob.java

1
package edu.ucsb.cs156.frontiers.jobs;
2
3
import edu.ucsb.cs156.frontiers.entities.Course;
4
import edu.ucsb.cs156.frontiers.services.GithubTeamService;
5
import edu.ucsb.cs156.frontiers.services.jobs.JobContext;
6
import edu.ucsb.cs156.frontiers.services.jobs.JobContextConsumer;
7
import lombok.Builder;
8
9
@Builder
10
public class DeleteTeamFromGithubJob implements JobContextConsumer {
11
  Integer githubTeamId;
12
  Course course;
13
  GithubTeamService githubTeamService;
14
15
  @Override
16
  public Course getCourse() {
17 1 1. getCourse : replaced return value with null for edu/ucsb/cs156/frontiers/jobs/DeleteTeamFromGithubJob::getCourse → KILLED
    return course;
18
  }
19
20
  @Override
21
  public void accept(JobContext ctx) throws Exception {
22
    ctx.log("Starting delete team from GitHub job for team ID " + githubTeamId);
23
24 1 1. accept : negated conditional → KILLED
    if (githubTeamId == null) {
25
      ctx.log("ERROR: Team has no GitHub team ID");
26
      return;
27
    }
28
29 2 1. accept : negated conditional → KILLED
2. accept : negated conditional → KILLED
    if (course.getOrgName() == null || course.getInstallationId() == null) {
30
      ctx.log("ERROR: Course has no linked GitHub organization");
31
      return;
32
    }
33
    // Get the organization id
34
    Integer orgId = null;
35
    try {
36
      orgId = githubTeamService.getOrgId(course.getOrgName(), course);
37
38
    } catch (Exception e) {
39
      ctx.log(
40
          "ERROR: Failed to get organization ID for org: "
41
              + course.getOrgName()
42
              + " - "
43
              + e.getMessage());
44
      return;
45
    }
46
47
    try {
48 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/GithubTeamService::deleteGithubTeam → KILLED
      githubTeamService.deleteGithubTeam(orgId, githubTeamId, course);
49
      ctx.log("Successfully deleted GitHub team");
50
    } catch (Exception e) {
51
      ctx.log("ERROR: Failed to delete GitHub team: " + e.getMessage());
52
    }
53
54
    ctx.log("Done");
55
  }
56
}

Mutations

17

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

24

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

29

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

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

48

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.DeleteTeamFromGithubJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.DeleteTeamFromGithubJobTests]/[method:test_successfully_delete_team()]
removed call to edu/ucsb/cs156/frontiers/services/GithubTeamService::deleteGithubTeam → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0