User.java

1
package edu.ucsb.cs156.happiercows.entities;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import lombok.*;
5
6
import javax.persistence.*;
7
import java.util.List;
8
9
@Data
10
@AllArgsConstructor
11
@NoArgsConstructor(access = AccessLevel.PROTECTED)
12
@Builder
13
@Entity(name = "users")
14
public class User {
15
    @Id
16
    @GeneratedValue(strategy = GenerationType.IDENTITY)
17
    private long id;
18
    private String email;
19
    private String googleSub;
20
    private String pictureUrl;
21
    private String fullName;
22
    private String givenName;
23
    private String familyName;
24
    private boolean emailVerified;
25
    private String locale;
26
    private String hostedDomain;
27
    private boolean admin;
28
29
    // this is used by the frontend
30
    @ManyToMany(fetch = FetchType.EAGER)
31
    @JoinTable(name = "user_commons",
32
            joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"),
33
            inverseJoinColumns = @JoinColumn(name = "commons_id", referencedColumnName = "id"))
34
    private List<Commons> commons;
35
36
    @OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE)
37
    @JsonIgnore
38
    private List<UserCommons> joinedCommons;
39
40
41
    @Override
42
    public String toString() {
43 1 1. toString : replaced return value with "" for edu/ucsb/cs156/happiercows/entities/User::toString → KILLED
        return String.format("User: id=%d email=%s", id, email);
44
    }
45
}

Mutations

43

1.1
Location : toString
Killed by : edu.ucsb.cs156.happiercows.entities.UserTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.UserTests]/[method:test_toString()]
replaced return value with "" for edu/ucsb/cs156/happiercows/entities/User::toString → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3