TestJob.java

1
package edu.ucsb.cs156.dining.jobs;
2
3
import edu.ucsb.cs156.jobs.services.JobContext;
4
import edu.ucsb.cs156.jobs.services.JobContextConsumer;
5
import lombok.Builder;
6
import lombok.Getter;
7
8
/**
9
 * A trivial job for testing the jobs infrastructure from the admin console: logs a line, sleeps,
10
 * then either fails or logs a goodbye.
11
 */
12
@Builder
13
public class TestJob implements JobContextConsumer {
14
15
  @Getter private boolean fail;
16
  @Getter private int sleepMs;
17
18
  @Override
19
  public void accept(JobContext ctx) throws Exception {
20 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
    ctx.log("Hello World! from test job!");
21 1 1. accept : removed call to java/lang/Thread::sleep → KILLED
    Thread.sleep(sleepMs);
22 1 1. accept : negated conditional → KILLED
    if (fail) {
23
      throw new Exception("Fail!");
24
    }
25 1 1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED
    ctx.log("Goodbye from test job!");
26
  }
27
}

Mutations

20

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

21

1.1
Location : accept
Killed by : edu.ucsb.cs156.dining.jobs.TestJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.dining.jobs.TestJobTests]/[method:logs_hello_sleeps_and_says_goodbye()]
removed call to java/lang/Thread::sleep → KILLED

22

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

25

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

Active mutators

Tests examined


Report generated by PIT 1.17.0