InstructorReportJob.java

1
package edu.ucsb.cs156.happiercows.jobs;
2
3
import edu.ucsb.cs156.happiercows.entities.Commons;
4
import edu.ucsb.cs156.happiercows.entities.Report;
5
import edu.ucsb.cs156.happiercows.repositories.CommonsRepository;
6
import edu.ucsb.cs156.happiercows.services.jobs.JobContext;
7
import edu.ucsb.cs156.happiercows.services.jobs.JobContextConsumer;
8
import edu.ucsb.cs156.happiercows.services.ReportService;
9
import lombok.AllArgsConstructor;
10
import lombok.Getter;
11
12
@AllArgsConstructor
13
public class InstructorReportJob implements JobContextConsumer {
14
15
    @Getter
16
    private ReportService reportService;
17
18
    @Getter
19
    private CommonsRepository commonsRepository;
20
21
    @Override
22
    public void accept(JobContext ctx) throws Exception {
23 1 1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED
        ctx.log("Starting instructor report...");
24
        Iterable<Commons> allCommons = commonsRepository.findAll();
25
26
        for (Commons commons : allCommons) {
27 1 1. accept : negated conditional → KILLED
            if (!commons.gameInProgress()) {
28 1 1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED
                ctx.log("Skipping Producing Report for Commons: " + commons.getName() + " because game is not in progress");
29
                continue;
30
            }
31 1 1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED
            ctx.log(String.format("Starting Commons id=%d (%s)...", commons.getId(), commons.getName()));
32
            Report report = reportService.createReport(commons.getId());
33 1 1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED
            ctx.log(String.format("Report %d for commons id=%d (%s) finished.", report.getId(), commons.getId(),
34
                    commons.getName()));
35
        }
36 1 1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED
        ctx.log("Instructor report done!");
37
    }
38
}

Mutations

23

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

27

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

28

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

31

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

33

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

36

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

Active mutators

Tests examined


Report generated by PIT 1.7.3