UserInfoController.java

1
package edu.ucsb.cs156.example.controllers;
2
3
import edu.ucsb.cs156.example.entities.User;
4
import edu.ucsb.cs156.example.models.CurrentUser;
5
import edu.ucsb.cs156.example.services.CurrentUserService;
6
7
import io.swagger.v3.oas.annotations.Operation;
8
import io.swagger.v3.oas.annotations.tags.Tag;
9
10
import org.springframework.security.access.prepost.PreAuthorize;
11
import org.springframework.web.bind.annotation.GetMapping;
12
import org.springframework.web.bind.annotation.RequestMapping;
13
import org.springframework.web.bind.annotation.RestController;
14
15
/**
16
 * This is a REST controller for getting information about the current user.
17
 */
18
19
@Tag(name="Current User Information")
20
@RequestMapping("/api/currentUser")
21
@RestController
22
public class UserInfoController extends ApiController {
23
 
24
  /**
25
   * This method returns the current user.
26
   * @return the current user
27
   */
28
29
  @Operation(summary= "Get information about current user")
30
  @PreAuthorize("hasRole('ROLE_USER')")
31
  @GetMapping("")
32
  public CurrentUser getCurrentUser() {
33 1 1. getCurrentUser : replaced return value with null for edu/ucsb/cs156/example/controllers/UserInfoController::getCurrentUser → KILLED
    return super.getCurrentUser();
34
  }
35
}

Mutations

33

1.1
Location : getCurrentUser
Killed by : edu.ucsb.cs156.example.controllers.UserInfoControllerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.example.controllers.UserInfoControllerTests]/[method:currentUser__logged_in()]
replaced return value with null for edu/ucsb/cs156/example/controllers/UserInfoController::getCurrentUser → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3