UCSBAPIQuarterController.java

1
package edu.ucsb.cs156.courses.controllers;
2
3
import edu.ucsb.cs156.courses.entities.UCSBAPIQuarter;
4
import edu.ucsb.cs156.courses.repositories.UserRepository;
5
import edu.ucsb.cs156.courses.services.UCSBAPIQuarterService;
6
import io.swagger.v3.oas.annotations.Operation;
7
import io.swagger.v3.oas.annotations.tags.Tag;
8
import java.util.List;
9
import lombok.extern.slf4j.Slf4j;
10
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.security.access.prepost.PreAuthorize;
12
import org.springframework.web.bind.annotation.GetMapping;
13
import org.springframework.web.bind.annotation.PostMapping;
14
import org.springframework.web.bind.annotation.RequestMapping;
15
import org.springframework.web.bind.annotation.RestController;
16
17
@Tag(name = "UCSBAPIQuarterController")
18
@RestController
19
@RequestMapping("/api/public")
20
@Slf4j
21
public class UCSBAPIQuarterController extends ApiController {
22
23
  @Autowired UserRepository userRepository;
24
  @Autowired UCSBAPIQuarterService ucsbAPIQuarterService;
25
26
  @Operation(summary = "Get dates for current quarter")
27
  @GetMapping(value = "/currentQuarter", produces = "application/json")
28
  public UCSBAPIQuarter getCurrentQuarter() throws Exception {
29 1 1. getCurrentQuarter : replaced return value with null for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::getCurrentQuarter → KILLED
    return ucsbAPIQuarterService.getCurrentQuarter();
30
  }
31
32
  @Operation(summary = "Get dates for all quarters")
33
  @GetMapping(value = "/allQuarters", produces = "application/json")
34
  public List<UCSBAPIQuarter> getAllQuarters() throws Exception {
35 1 1. getAllQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::getAllQuarters → KILLED
    return ucsbAPIQuarterService.getAllQuarters();
36
  }
37
38
  @Operation(summary = "Load quarters into database from UCSB API")
39
  @PreAuthorize("hasRole('ROLE_ADMIN')")
40
  @PostMapping("/loadQuarters")
41
  public List<UCSBAPIQuarter> loadQuarters() throws Exception {
42
    List<UCSBAPIQuarter> savedQuarters = ucsbAPIQuarterService.loadAllQuarters();
43 1 1. loadQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::loadQuarters → KILLED
    return savedQuarters;
44
  }
45
46
  @Operation(summary = "Get list of active quarters")
47
  @GetMapping(value = "/activeQuarters", produces = "application/json")
48
  public List<String> activeQuarters() throws Exception {
49 1 1. activeQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::activeQuarters → KILLED
    return ucsbAPIQuarterService.getActiveQuarters();
50
  }
51
}

Mutations

29

1.1
Location : getCurrentQuarter
Killed by : edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests]/[method:test_currentQuarter()]
replaced return value with null for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::getCurrentQuarter → KILLED

35

1.1
Location : getAllQuarters
Killed by : edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests]/[method:test_allQuarters()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::getAllQuarters → KILLED

43

1.1
Location : loadQuarters
Killed by : edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests]/[method:test_loadQuarters()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::loadQuarters → KILLED

49

1.1
Location : activeQuarters
Killed by : edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.controllers.UCSBAPIQuarterControllerTests]/[method:test_activeQuarters()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::activeQuarters → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0