Farmer.java

1
package edu.ucsb.cs156.happiercows.entities;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import com.fasterxml.jackson.annotation.JsonInclude;
5
import lombok.*;
6
7
import jakarta.persistence.EmbeddedId;
8
import jakarta.persistence.Entity;
9
import jakarta.persistence.ManyToOne;
10
import jakarta.persistence.MapsId;
11
12
@Data
13
@AllArgsConstructor
14
@NoArgsConstructor(access = AccessLevel.PROTECTED)
15
@Builder
16
@Entity(name = "farmer")
17
public class Farmer {
18
    @EmbeddedId
19
    @JsonIgnore
20
    @Builder.Default
21
    private FarmerKey id = new FarmerKey();
22
23
    @MapsId("userId")
24
    @ManyToOne
25
    @JsonIgnore
26
    private User user;
27
28
    @MapsId("gameId")
29
    @ManyToOne
30
    @JsonIgnore
31
    private Game game;
32
33
    private String username;
34
35
    private double totalWealth;
36
37
    private int numOfCows;
38
39
    private double cowHealth;
40
41
    private int cowsBought;
42
43
    private int cowsSold;
44
45
    private int cowDeaths;
46
47
    // userID and gameId are used by the frontend
48
    @JsonInclude
49
    public long getUserId() {
50 1 1. getUserId : replaced long return with 0 for edu/ucsb/cs156/happiercows/entities/Farmer::getUserId → KILLED
      return user.getId();
51
    }
52
53
    @JsonInclude
54
    public long getGameId() {
55 1 1. getGameId : replaced long return with 0 for edu/ucsb/cs156/happiercows/entities/Farmer::getGameId → KILLED
        return game.getId();
56
    }
57
58
    public void setId(FarmerKey id) {
59
        this.id = id;
60
    }
61
    
62
    public FarmerKey getId() {
63 1 1. getId : replaced return value with null for edu/ucsb/cs156/happiercows/entities/Farmer::getId → KILLED
        return this.id;
64
    }
65
}

Mutations

50

1.1
Location : getUserId
Killed by : edu.ucsb.cs156.happiercows.entities.HerdTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.HerdTests]/[method:herd_serialized_to_json_includes_user_and_game_id_but_not_farmer()]
replaced long return with 0 for edu/ucsb/cs156/happiercows/entities/Farmer::getUserId → KILLED

55

1.1
Location : getGameId
Killed by : edu.ucsb.cs156.happiercows.entities.HerdTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.HerdTests]/[method:herd_serialized_to_json_includes_user_and_game_id_but_not_farmer()]
replaced long return with 0 for edu/ucsb/cs156/happiercows/entities/Farmer::getGameId → KILLED

63

1.1
Location : getId
Killed by : edu.ucsb.cs156.happiercows.entities.FarmerTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.FarmerTests]/[method:farmer_setId()]
replaced return value with null for edu/ucsb/cs156/happiercows/entities/Farmer::getId → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1