TestJob.java

1
package edu.ucsb.cs156.frontiers.jobs;
2
3
import lombok.Builder;
4
import org.springframework.security.core.Authentication;
5
import org.springframework.security.core.context.SecurityContextHolder;
6
7
import edu.ucsb.cs156.frontiers.services.jobs.JobContext;
8
import edu.ucsb.cs156.frontiers.services.jobs.JobContextConsumer;
9
10
@Builder
11
public class TestJob implements JobContextConsumer {
12
13
  private boolean fail;
14
  private int sleepMs;
15
16
  @Override
17
  public void accept(JobContext ctx) throws Exception {
18
    // Ensure this is not null
19
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
20
21 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/jobs/JobContext::log → KILLED
    ctx.log("Hello World! from test job!");
22 1 1. accept : removed call to java/lang/Thread::sleep → KILLED
    Thread.sleep(sleepMs);
23 1 1. accept : negated conditional → TIMED_OUT
    if (fail) {
24
      throw new Exception("Fail!");
25
    }
26 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/jobs/JobContext::log → TIMED_OUT
    ctx.log("Goodbye from test job!");
27
  }
28
}

Mutations

21

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

22

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.controllers.JobsControllerDetailedTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.controllers.JobsControllerDetailedTests]/[method:admin_can_launch_test_job()]
removed call to java/lang/Thread::sleep → KILLED

23

1.1
Location : accept
Killed by : none
negated conditional → TIMED_OUT

26

1.1
Location : accept
Killed by : none
removed call to edu/ucsb/cs156/frontiers/services/jobs/JobContext::log → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.17.0