RosterStudent.java

1
package edu.ucsb.cs156.frontiers.entities;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import edu.ucsb.cs156.frontiers.enums.OrgStatus;
5
import edu.ucsb.cs156.frontiers.enums.RosterStatus;
6
import jakarta.persistence.*;
7
import java.util.List;
8
import lombok.AllArgsConstructor;
9
import lombok.Builder;
10
import lombok.Data;
11
import lombok.NoArgsConstructor;
12
import lombok.ToString;
13
import org.hibernate.annotations.Fetch;
14
import org.hibernate.annotations.FetchMode;
15
16
@Data
17
@AllArgsConstructor
18
@NoArgsConstructor
19
@Builder
20
@Entity
21
@Table(
22
    uniqueConstraints = {
23
      @UniqueConstraint(
24
          name = "UK_ROSTER_STUDENT_COURSE_STUDENT",
25
          columnNames = {"course_id", "student_id"}),
26
      @UniqueConstraint(
27
          name = "UK_ROSTER_STUDENT_COURSE_EMAIL",
28
          columnNames = {"course_id", "email"})
29
    })
30
public class RosterStudent {
31
  @Id
32
  @GeneratedValue(strategy = GenerationType.IDENTITY)
33
  private Long id;
34
35
  @ManyToOne
36
  @JoinColumn(name = "course_id")
37
  private Course course;
38
39
  private String studentId;
40
  private String firstName;
41
  private String lastName;
42
  private String email;
43
  @Builder.Default private String section = "";
44
45
  @ManyToOne
46
  @JoinColumn(name = "user_id")
47
  @ToString.Exclude
48
  private User user;
49
50
  @OneToMany(cascade = CascadeType.ALL, mappedBy = "rosterStudent")
51
  @Fetch(FetchMode.JOIN)
52
  @JsonIgnore
53
  @ToString.Exclude
54
  private List<TeamMember> teamMembers;
55
56
  @Enumerated(EnumType.STRING)
57
  private RosterStatus rosterStatus;
58
59
  @Enumerated(EnumType.STRING)
60
  private OrgStatus orgStatus;
61
62
  private Integer githubId;
63
  private String githubLogin;
64
65
  public List<String> getTeams() {
66 1 1. getTeams : negated conditional → KILLED
    if (teamMembers == null) {
67
      return List.of();
68
    } else {
69 2 1. lambda$getTeams$0 : replaced return value with "" for edu/ucsb/cs156/frontiers/entities/RosterStudent::lambda$getTeams$0 → KILLED
2. getTeams : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/entities/RosterStudent::getTeams → KILLED
      return teamMembers.stream().map(tm -> tm.getTeam().getName()).toList();
70
    }
71
  }
72
}

Mutations

66

1.1
Location : getTeams
Killed by : edu.ucsb.cs156.frontiers.models.RosterStudentDTOTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.models.RosterStudentDTOTests]/[method:test_from_when_user_is_null()]
negated conditional → KILLED

69

1.1
Location : lambda$getTeams$0
Killed by : edu.ucsb.cs156.frontiers.models.RosterStudentDTOTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.models.RosterStudentDTOTests]/[method:test_when_student_is_on_team()]
replaced return value with "" for edu/ucsb/cs156/frontiers/entities/RosterStudent::lambda$getTeams$0 → KILLED

2.2
Location : getTeams
Killed by : edu.ucsb.cs156.frontiers.models.RosterStudentDTOTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.models.RosterStudentDTOTests]/[method:test_when_student_is_on_team()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/entities/RosterStudent::getTeams → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0