CourseInstructorController.java

1
package edu.ucsb.cs156.courses.controllers;
2
3
import java.util.List;
4
import io.swagger.annotations.ApiParam;
5
import edu.ucsb.cs156.courses.collections.ConvertedSectionCollection;
6
import edu.ucsb.cs156.courses.documents.ConvertedSection;
7
import io.swagger.annotations.ApiOperation;
8
9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.http.ResponseEntity;
13
import org.springframework.web.bind.annotation.GetMapping;
14
import org.springframework.web.bind.annotation.RequestMapping;
15
import org.springframework.web.bind.annotation.RequestParam;
16
import org.springframework.web.bind.annotation.RestController;
17
18
import com.fasterxml.jackson.core.JsonProcessingException;
19
import com.fasterxml.jackson.databind.ObjectMapper;
20
21
@RestController
22
@RequestMapping("/api/public/courseinstructor")
23
public class CourseInstructorController {
24
25
    private final Logger logger = LoggerFactory.getLogger(CourseInstructorController.class);
26
27
    private ObjectMapper mapper = new ObjectMapper();
28
29
    @Autowired
30
    ConvertedSectionCollection convertedSectionCollection;
31
32
    @ApiOperation(value = "Get a list of course instructors")
33
    @GetMapping(value = "/search", produces = "application/json")
34
    public ResponseEntity<String> search(
35
        @RequestParam String startQtr,
36
        @RequestParam String endQtr,
37
        @ApiParam(name = "instructor", type = "String", value = "Name of Instructor", example = "Conrad", required = true) @RequestParam String instructor
38
    ) throws JsonProcessingException {
39
        List<ConvertedSection> courseResults = convertedSectionCollection.findByQuarterRangeAndInstructor(
40
            startQtr,
41
            endQtr,
42
            instructor
43
        );
44
        String body = mapper.writeValueAsString(courseResults);
45 1 1. search : replaced return value with null for edu/ucsb/cs156/courses/controllers/CourseInstructorController::search → KILLED
        return ResponseEntity.ok().body(body);
46
    }
47
}

Mutations

45

1.1
Location : search
Killed by : edu.ucsb.cs156.courses.controllers.CourseInstructorControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.controllers.CourseInstructorControllerTests]/[method:test_search_emptyRequest()]
replaced return value with null for edu/ucsb/cs156/courses/controllers/CourseInstructorController::search → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3