GeneralEducationFullController.java

1
package edu.ucsb.cs156.courses.controllers;
2
3
import com.fasterxml.jackson.core.JsonProcessingException;
4
import com.fasterxml.jackson.databind.ObjectMapper;
5
import edu.ucsb.cs156.courses.collections.ConvertedSectionCollection;
6
import edu.ucsb.cs156.courses.documents.ConvertedSection;
7
import io.swagger.v3.oas.annotations.Operation;
8
import io.swagger.v3.oas.annotations.Parameter;
9
import java.util.List;
10
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.http.ResponseEntity;
12
import org.springframework.web.bind.annotation.GetMapping;
13
import org.springframework.web.bind.annotation.RequestMapping;
14
import org.springframework.web.bind.annotation.RequestParam;
15
import org.springframework.web.bind.annotation.RestController;
16
17
@RestController
18
@RequestMapping("/api/public/generalEducation")
19
public class GeneralEducationFullController {
20
21
  private ObjectMapper mapper = new ObjectMapper();
22
23
  @Autowired ConvertedSectionCollection convertedSectionCollection;
24
25
  @Operation(summary = "Get a list of courses over time, filtered by GE Area")
26
  @GetMapping(value = "/gesearch", produces = "application/json")
27
  public ResponseEntity<String> search(
28
      @Parameter(
29
              name = "startQtr",
30
              description =
31
                  "Starting quarter in yyyyq format, e.g. 20231 for W23, 20232 for S23, etc. (1=Winter, 2=Spring, 3=Summer, 4=Fall)",
32
              example = "20231",
33
              required = true)
34
          @RequestParam
35
          String startQtr,
36
      @Parameter(
37
              name = "endQtr",
38
              description =
39
                  "Ending quarter in yyyyq format, e.g. 20231 for W23, 20232 for S23, etc. (1=Winter, 2=Spring, 3=Summer, 4=Fall)",
40
              example = "20231",
41
              required = true)
42
          @RequestParam
43
          String endQtr,
44
      @Parameter(name = "geCode", description = "GE Code", example = "A1", required = true)
45
          @RequestParam
46
          String geCode)
47
      throws JsonProcessingException {
48
    List<ConvertedSection> courseResults =
49
        convertedSectionCollection.findByQuarterRangeAndGECode(startQtr, endQtr, geCode);
50
    String body = mapper.writeValueAsString(courseResults);
51 1 1. search : replaced return value with null for edu/ucsb/cs156/courses/controllers/GeneralEducationFullController::search → KILLED
    return ResponseEntity.ok().body(body);
52
  }
53
}

Mutations

51

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

Active mutators

Tests examined


Report generated by PIT 1.17.0