TestJob.java

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

Mutations

22

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

23

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

24

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

26

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

28

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

29

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

32

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

Active mutators

Tests examined


Report generated by PIT 1.7.3