TestJob.java

1
package edu.ucsb.cs156.courses.jobs;
2
3
import edu.ucsb.cs156.jobs.services.JobContext;
4
import edu.ucsb.cs156.jobs.services.JobContextConsumer;
5
import lombok.Builder;
6
7
/**
8
 * A trivial job for testing the jobs infrastructure from the admin console: logs a line, sleeps,
9
 * then either fails or logs a goodbye. The admin frontend already has a form wired up to launch
10
 * this (TestJobForm/SingleButtonJobForm), but this app had no backend endpoint to receive it.
11
 */
12
@Builder
13
public class TestJob implements JobContextConsumer {
14
15
  private boolean fail;
16
  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.courses.jobs.TestJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.jobs.TestJobTests]/[method:throws_and_skips_goodbye_when_fail_is_true()]
removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED

21

1.1
Location : accept
Killed by : edu.ucsb.cs156.courses.jobs.TestJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.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.courses.jobs.TestJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.jobs.TestJobTests]/[method:throws_and_skips_goodbye_when_fail_is_true()]
negated conditional → KILLED

25

1.1
Location : accept
Killed by : edu.ucsb.cs156.courses.jobs.TestJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.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