LegacyAssessmentController.java

1
package edu.ucsb.cs.scaffold.controller;
2
3
import edu.ucsb.cs.scaffold.model.Assessment;
4
import edu.ucsb.cs.scaffold.model.Question;
5
import edu.ucsb.cs.scaffold.repository.AssessmentRepository;
6
import edu.ucsb.cs.scaffold.repository.QuestionRepository;
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 java.util.List;
11
import java.util.UUID;
12
import lombok.RequiredArgsConstructor;
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.web.bind.annotation.GetMapping;
15
import org.springframework.web.bind.annotation.PathVariable;
16
import org.springframework.web.bind.annotation.RestController;
17
18
// Frozen copy of AssessmentController serving only LegacyHomePage.tsx (via legacyClient.ts),
19
// so the non-legacy endpoints can change shape without touching the legacy page. Reads the
20
// same tables; only the endpoint contract is frozen.
21
@Tag(name = "Legacy Assessments")
22
@RestController
23
@RequiredArgsConstructor
24
public class LegacyAssessmentController {
25
26
  @Autowired private final AssessmentRepository assessmentRepository;
27
28
  @Autowired private final QuestionRepository questionRepository;
29
30
  @Operation(summary = "List all assessments ordered by name (legacy)")
31
  @GetMapping("/api/legacy/assessments")
32
  public List<Assessment> getAssessments() {
33 1 1. getAssessments : replaced return value with Collections.emptyList for edu/ucsb/cs/scaffold/controller/LegacyAssessmentController::getAssessments → KILLED
    return assessmentRepository.findAllByOrderByNameAsc();
34
  }
35
36
  @Operation(summary = "List questions for an assessment ordered by title (legacy)")
37
  @GetMapping("/api/legacy/assessments/{assessmentId}/questions")
38
  public List<Question> getQuestions(
39
      @Parameter(description = "UUID of the assessment") @PathVariable UUID assessmentId) {
40 1 1. getQuestions : replaced return value with Collections.emptyList for edu/ucsb/cs/scaffold/controller/LegacyAssessmentController::getQuestions → KILLED
    return questionRepository.findByAssessmentIdOrderByTitleAsc(assessmentId);
41
  }
42
}

Mutations

33

1.1
Location : getAssessments
Killed by : edu.ucsb.cs.scaffold.controller.LegacyAssessmentControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs.scaffold.controller.LegacyAssessmentControllerTests]/[method:any_user_can_get_assessments()]
replaced return value with Collections.emptyList for edu/ucsb/cs/scaffold/controller/LegacyAssessmentController::getAssessments → KILLED

40

1.1
Location : getQuestions
Killed by : edu.ucsb.cs.scaffold.controller.LegacyAssessmentControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs.scaffold.controller.LegacyAssessmentControllerTests]/[method:any_user_can_get_questions_for_assessment()]
replaced return value with Collections.emptyList for edu/ucsb/cs/scaffold/controller/LegacyAssessmentController::getQuestions → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0