DashboardController.java

1
package com.edtech.controller;
2
3
import com.edtech.model.DocumentStatus;
4
import com.edtech.model.User;
5
import com.edtech.repository.DocumentRepository;
6
import java.util.HashMap;
7
import java.util.Map;
8
import org.springframework.http.ResponseEntity;
9
import org.springframework.security.core.Authentication;
10
import org.springframework.web.bind.annotation.GetMapping;
11
import org.springframework.web.bind.annotation.RequestMapping;
12
import org.springframework.web.bind.annotation.RestController;
13
14
/** Documentação para DashboardController. */
15
@RestController
16
@RequestMapping("/api/dashboard")
17
public class DashboardController {
18
19
  private final DocumentRepository documentRepository;
20
21
  /** Documentação para o método DashboardController. */
22
  public DashboardController(DocumentRepository documentRepository) {
23
    this.documentRepository = documentRepository;
24
  }
25
26
  /** Documentação. */
27
  @GetMapping("/stats")
28
  public ResponseEntity<Map<String, Object>> getStats(Authentication authentication) {
29
    User user = (User) authentication.getPrincipal();
30
31
    long totalDocs = documentRepository.countDocumentsByUserId(user.getId());
32
    long pendingReviewDocs =
33
        documentRepository.countDocumentsByUserIdAndStatus(
34
            user.getId(), DocumentStatus.PENDING_REVIEW);
35
36
    Map<String, Object> stats = new HashMap<>();
37
    stats.put("activeDocuments", totalDocs);
38
    stats.put("pendingReview", pendingReviewDocs);
39
    stats.put("complianceScore", 92); // TODO: Implementar lógica de conformidade real
40
    stats.put("researchProgress", 68); // TODO: Implementar lógica de progresso real
41
42 1 1. getStats : replaced return value with null for com/edtech/controller/DashboardController::getStats → KILLED
    return ResponseEntity.ok(stats);
43
  }
44
}

Mutations

42

1.1
Location : getStats
Killed by : com.edtech.controller.DashboardControllerTest.[engine:junit-jupiter]/[class:com.edtech.controller.DashboardControllerTest]/[method:testGetStats()]
replaced return value with null for com/edtech/controller/DashboardController::getStats → KILLED

Active mutators

Tests examined


Report generated by PIT 1.16.1