CourseController.java

1
package edu.ucsb.cs156.happiercows.controllers;
2
3
import edu.ucsb.cs156.happiercows.entities.Course;
4
import edu.ucsb.cs156.happiercows.repositories.CourseRepository;
5
import io.swagger.v3.oas.annotations.tags.Tag;
6
import io.swagger.v3.oas.annotations.Operation;
7
import lombok.extern.slf4j.Slf4j;
8
import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.security.access.prepost.PreAuthorize;
10
import org.springframework.web.bind.annotation.*;
11
12
@Slf4j
13
@Tag(name = "Course")
14
@RequestMapping("/api/course")
15
@RestController
16
public class CourseController extends ApiController {
17
    @Autowired
18
    private CourseRepository courseRepository;
19
20
    /**
21
     * This method returns a list of all courses.
22
     * 
23
     * @return a list of all courses
24
     */
25
    @Operation(summary = "List all courses")
26
    @PreAuthorize("hasRole('ROLE_USER')")
27
    @GetMapping("/all")
28
    public Iterable<Course> allOrganisations() {
29
        Iterable<Course> courses = courseRepository.findAll();
30 1 1. allOrganisations : replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CourseController::allOrganisations → KILLED
        return courses;
31
    }
32
}

Mutations

30

1.1
Location : allOrganisations
Killed by : edu.ucsb.cs156.happiercows.controllers.CourseControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.controllers.CourseControllerTests]/[method:logged_in_user_can_get_all_courses()]
replaced return value with null for edu/ucsb/cs156/happiercows/controllers/CourseController::allOrganisations → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3