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

Mutations

30

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

36

1.1
Location : getActiveQuarters
Killed by : none
replaced return value with null for edu/ucsb/cs156/courses/controllers/UCSBAPIQuarterController::getActiveQuarters → NO_COVERAGE

42

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

50

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

Active mutators

Tests examined


Report generated by PIT 1.17.0