GradeHistoryController.java

1
package edu.ucsb.cs156.courses.controllers;
2
3
import com.fasterxml.jackson.databind.ObjectMapper;
4
import edu.ucsb.cs156.courses.entities.GradeHistory;
5
import edu.ucsb.cs156.courses.repositories.GradeHistoryRepository;
6
import edu.ucsb.cs156.courses.utilities.CourseUtilities;
7
import io.swagger.v3.oas.annotations.Operation;
8
import io.swagger.v3.oas.annotations.Parameter;
9
import io.swagger.v3.oas.annotations.tags.Tag;
10
import lombok.extern.slf4j.Slf4j;
11
import org.springframework.beans.factory.annotation.Autowired;
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
@Slf4j
18
@Tag(name = "API for grade history data")
19
@RequestMapping("/api/gradehistory")
20
@RestController
21
public class GradeHistoryController extends ApiController {
22
  @Autowired GradeHistoryRepository gradeHistoryRepository;
23
24
  @Autowired ObjectMapper mapper;
25
26
  @Operation(summary = "Get grade history for a course")
27
  @GetMapping(value = "/search", produces = "application/json")
28
  public Iterable<GradeHistory> gradeHistoryBySubjectAreaAndCourseNumber(
29
      @Parameter(
30
              name = "subjectArea",
31
              description = "Subjects of UCSB",
32
              example = "CMPSC",
33
              required = true)
34
          @RequestParam
35
          String subjectArea,
36
      @Parameter(
37
              name = "courseNumber",
38
              description = "Represents a subject-specific course",
39
              example = "130A",
40
              required = true)
41
          @RequestParam
42
          String courseNumber) {
43
    String course = CourseUtilities.makeFormattedCourseId(subjectArea, courseNumber);
44
    Iterable<GradeHistory> gradeHistoryRows = gradeHistoryRepository.findByCourse(course);
45 1 1. gradeHistoryBySubjectAreaAndCourseNumber : replaced return value with null for edu/ucsb/cs156/courses/controllers/GradeHistoryController::gradeHistoryBySubjectAreaAndCourseNumber → KILLED
    return gradeHistoryRows;
46
  }
47
}

Mutations

45

1.1
Location : gradeHistoryBySubjectAreaAndCourseNumber
Killed by : edu.ucsb.cs156.courses.controllers.GradeHistoryControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.controllers.GradeHistoryControllerTests]/[method:test_getGradeHistory()]
replaced return value with null for edu/ucsb/cs156/courses/controllers/GradeHistoryController::gradeHistoryBySubjectAreaAndCourseNumber → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3