Commons.java

1
package edu.ucsb.cs156.happiercows.entities;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import edu.ucsb.cs156.happiercows.strategies.CowHealthUpdateStrategies;
5
import lombok.AllArgsConstructor;
6
import lombok.Builder;
7
import lombok.Data;
8
import lombok.NoArgsConstructor;
9
10
import javax.persistence.*;
11
import java.time.LocalDateTime;
12
import java.util.List;
13
14
15
16
@Data
17
@AllArgsConstructor
18
@NoArgsConstructor
19
@Builder
20
@Entity(name = "commons")
21
public class Commons {
22
    @Id
23
    @GeneratedValue(strategy = GenerationType.IDENTITY)
24
    private long id;
25
    private String name;
26
    private double cowPrice;
27
    private double milkPrice;
28
    private double startingBalance;
29
    private LocalDateTime startingDate;
30
    private boolean showLeaderboard;
31
    private LocalDateTime lastDay;
32
    
33
    private int capacityPerUser;
34
    private int carryingCapacity;
35
    private double degradationRate;
36
    
37
    public boolean gameInProgress(){
38 2 1. gameInProgress : negated conditional → KILLED
2. gameInProgress : negated conditional → KILLED
        boolean output = (startingDate.isBefore(LocalDateTime.now()) && lastDay.isAfter(LocalDateTime.now()));
39 2 1. gameInProgress : replaced boolean return with false for edu/ucsb/cs156/happiercows/entities/Commons::gameInProgress → KILLED
2. gameInProgress : replaced boolean return with true for edu/ucsb/cs156/happiercows/entities/Commons::gameInProgress → KILLED
        return output;
40
      }
41
42
    @Enumerated(EnumType.STRING)
43
    @Builder.Default
44
    private CowHealthUpdateStrategies belowCapacityHealthUpdateStrategy = CowHealthUpdateStrategies.DEFAULT_BELOW_CAPACITY;
45
    @Enumerated(EnumType.STRING)
46
    @Builder.Default
47
    private CowHealthUpdateStrategies aboveCapacityHealthUpdateStrategy = CowHealthUpdateStrategies.DEFAULT_ABOVE_CAPACITY;
48
49
    @OneToMany(mappedBy = "commons", cascade = CascadeType.REMOVE)
50
    @JsonIgnore
51
    private List<UserCommons> joinedUsers;
52
53
    
54
}

Mutations

38

1.1
Location : gameInProgress
Killed by : edu.ucsb.cs156.happiercows.entities.CommonsTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.CommonsTest]/[method:test_gameInProgress_False_Not_Started()]
negated conditional → KILLED

2.2
Location : gameInProgress
Killed by : edu.ucsb.cs156.happiercows.entities.CommonsTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.CommonsTest]/[method:test_gameInProgressTrue()]
negated conditional → KILLED

39

1.1
Location : gameInProgress
Killed by : edu.ucsb.cs156.happiercows.entities.CommonsTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.CommonsTest]/[method:test_gameInProgressTrue()]
replaced boolean return with false for edu/ucsb/cs156/happiercows/entities/Commons::gameInProgress → KILLED

2.2
Location : gameInProgress
Killed by : edu.ucsb.cs156.happiercows.entities.CommonsTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.happiercows.entities.CommonsTest]/[method:test_gameInProgress_False_Not_Started()]
replaced boolean return with true for edu/ucsb/cs156/happiercows/entities/Commons::gameInProgress → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3