TestJob.java

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

Mutations

22

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

23

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

24

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

27

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

Active mutators

Tests examined


Report generated by PIT 1.7.3