TestJob.java

1
package edu.ucsb.cs156.courses.jobs;
2
3
import org.springframework.security.core.Authentication;
4
import org.springframework.security.core.context.SecurityContextHolder;
5
6
import edu.ucsb.cs156.courses.services.jobs.JobContext;
7
import edu.ucsb.cs156.courses.services.jobs.JobContextConsumer;
8
import lombok.Builder;
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/courses/services/jobs/JobContext::log → KILLED
            ctx.log("Hello World! from test job!");
22 1 1. accept : negated conditional → KILLED
            if (authentication == null) {
23 1 1. accept : removed call to edu/ucsb/cs156/courses/services/jobs/JobContext::log → KILLED
                ctx.log("authentication is null");
24
            } else {
25 1 1. accept : removed call to edu/ucsb/cs156/courses/services/jobs/JobContext::log → KILLED
                ctx.log("authentication is not null");
26
            }
27 1 1. accept : removed call to java/lang/Thread::sleep → KILLED
            Thread.sleep(sleepMs);
28 1 1. accept : negated conditional → KILLED
            if (fail) {
29
                throw new Exception("Fail!");
30
            }
31 1 1. accept : removed call to edu/ucsb/cs156/courses/services/jobs/JobContext::log → KILLED
            ctx.log("Goodbye from test job!");
32
    }
33
}

Mutations

21

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

23

1.1
Location : accept
Killed by : edu.ucsb.cs156.courses.jobs.TestJobTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.jobs.TestJobTests]/[method:test_log_output_with_no_user()]
removed call to edu/ucsb/cs156/courses/services/jobs/JobContext::log → 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:test_log_output_with_mock_user()]
removed call to edu/ucsb/cs156/courses/services/jobs/JobContext::log → KILLED

27

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

28

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

31

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

Active mutators

Tests examined


Report generated by PIT 1.7.3