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.jobs.services.JobContext;
6
import edu.ucsb.cs156.jobs.services.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 String getScopeType() {
17 1 1. getScopeType : replaced return value with "" for edu/ucsb/cs156/frontiers/jobs/DeleteTeamFromGithubJob::getScopeType → KILLED
    return "course";
18
  }
19
20
  @Override
21
  public Long getScopeId() {
22 1 1. getScopeId : replaced Long return value with 0L for edu/ucsb/cs156/frontiers/jobs/DeleteTeamFromGithubJob::getScopeId → KILLED
    return course.getId();
23
  }
24
25
  @Override
26
  public void accept(JobContext ctx) throws Exception {
27 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
    ctx.log("Starting delete team from GitHub job for team ID " + githubTeamId);
28
29 1 1. accept : negated conditional → KILLED
    if (githubTeamId == null) {
30 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
      ctx.log("ERROR: Team has no GitHub team ID");
31
      return;
32
    }
33
34 2 1. accept : negated conditional → KILLED
2. accept : negated conditional → KILLED
    if (course.getOrgName() == null || course.getInstallationId() == null) {
35 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
      ctx.log("ERROR: Course has no linked GitHub organization");
36
      return;
37
    }
38
    // Get the organization id
39
    Integer orgId = null;
40
    try {
41
      orgId = githubTeamService.getOrgId(course.getOrgName(), course);
42
    } catch (Exception e) {
43
      throw new IllegalStateException(
44
          "Failed to get organization ID for org: " + course.getOrgName() + " - " + e.getMessage(),
45
          e);
46
    }
47
48
    try {
49 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/GithubTeamService::deleteGithubTeam → KILLED
      githubTeamService.deleteGithubTeam(orgId, githubTeamId, course);
50 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
      ctx.log("Successfully deleted GitHub team");
51
    } catch (Exception e) {
52
      throw new IllegalStateException("Failed to delete GitHub team: " + e.getMessage(), e);
53
    }
54
55 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
    ctx.log("Done");
56
  }
57
}

Mutations

17

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

22

1.1
Location : getScopeId
Killed by : edu.ucsb.cs156.frontiers.jobs.DeleteTeamFromGithubJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.DeleteTeamFromGithubJobTests]/[method:test_getScope_returnsCourseScope()]
replaced Long return value with 0L for edu/ucsb/cs156/frontiers/jobs/DeleteTeamFromGithubJob::getScopeId → KILLED

27

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/jobs/services/JobContext::log → 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_CourseWithoutGithubOrg()]
negated conditional → KILLED

30

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

34

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

35

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()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

49

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

50

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/jobs/services/JobContext::log → KILLED

55

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/jobs/services/JobContext::log → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support