UCSBDiningMenuController.java

1
package edu.ucsb.cs156.dining.controllers;
2
3
import edu.ucsb.cs156.dining.services.UCSBDiningMenuService;
4
import edu.ucsb.cs156.dining.errors.EntityNotFoundException;
5
import edu.ucsb.cs156.dining.repositories.UserRepository;
6
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
12
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.security.access.prepost.PreAuthorize;
14
import org.springframework.web.bind.annotation.DeleteMapping;
15
import org.springframework.web.bind.annotation.GetMapping;
16
import org.springframework.web.bind.annotation.PostMapping;
17
import org.springframework.web.bind.annotation.PutMapping;
18
import org.springframework.web.bind.annotation.RequestBody;
19
import org.springframework.web.bind.annotation.RequestMapping;
20
import org.springframework.web.bind.annotation.RestController;
21
import org.springframework.web.bind.annotation.PathVariable;
22
import org.springframework.http.ResponseEntity;
23
import java.time.LocalDate;
24
import java.time.LocalDateTime;
25
import org.springframework.format.annotation.DateTimeFormat;
26
import java.util.List;
27
28
import jakarta.validation.Valid;
29
30
@Tag(name = "UCSBDiningMenuController")
31
@RestController
32
@RequestMapping("/api/diningcommons")
33
@Slf4j
34
public class UCSBDiningMenuController extends ApiController {
35
36
  @Autowired UCSBDiningMenuService ucsbDiningMenuService;
37
38
  @Operation(summary = "Get list of meals serving in given dining common on given date")
39
  @GetMapping(value = "/{date-time}/{dining-commons-code}", produces = "application/json")
40
  public ResponseEntity<String> menutimes(
41
      @Parameter(description= "date (in iso format, e.g. YYYY-mm-dd) or date-time (in iso format e.g. YYYY-mm-ddTHH:MM:SS)") 
42
      @PathVariable("date-time") String datetime,
43
      @PathVariable("dining-commons-code") String diningcommoncode
44
  )
45
    throws Exception {
46
47
    String body = ucsbDiningMenuService.getJSON(datetime, diningcommoncode);
48
49 1 1. menutimes : replaced return value with null for edu/ucsb/cs156/dining/controllers/UCSBDiningMenuController::menutimes → KILLED
    return ResponseEntity.ok().body(body);
50
  }
51
}

Mutations

49

1.1
Location : menutimes
Killed by : edu.ucsb.cs156.dining.controllers.UCSBDiningMenuControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.dining.controllers.UCSBDiningMenuControllerTests]/[method:users_can_see_meal_times()]
replaced return value with null for edu/ucsb/cs156/dining/controllers/UCSBDiningMenuController::menutimes → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0