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