JobContext.java

1
package edu.ucsb.cs156.happiercows.services.jobs;
2
3
import edu.ucsb.cs156.happiercows.entities.jobs.Job;
4
import edu.ucsb.cs156.happiercows.repositories.jobs.JobsRepository;
5
import lombok.AllArgsConstructor;
6
import lombok.extern.slf4j.Slf4j;
7
8
@AllArgsConstructor
9
@Slf4j
10
public class JobContext {
11
  private JobsRepository jobsRepository;
12
  private Job job;
13
14
  public void log(String message) {
15
    log.info("Job %s: %s".formatted(job.getId(), message));
16 1 1. log : negated conditional → KILLED
    String previousLog = job.getLog() == null ? "" : (job.getLog() + "\n");
17 1 1. log : removed call to edu/ucsb/cs156/happiercows/entities/jobs/Job::setLog → KILLED
    job.setLog(previousLog + message);
18 1 1. log : negated conditional → KILLED
    if (jobsRepository != null) {
19
      jobsRepository.save(job);
20
    }
21
  }
22
}

Mutations

16

1.1
Location : log
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

17

1.1
Location : log
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/entities/jobs/Job::setLog → KILLED

18

1.1
Location : log
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

Active mutators

Tests examined


Report generated by PIT 1.7.3