IrrigationDeck.java

1
package com.takenoko.asset;
2
3
/** IrrigationDeck represents the irrigation deck, defaults to 20 irrigation. */
4
public class IrrigationDeck {
5
    public static final int DEFAULT_SIZE = 20;
6
    private int size;
7
8
    /** Creates a new IrrigationDeck with the default size. */
9
    public IrrigationDeck() {
10
        size = DEFAULT_SIZE;
11
    }
12
13
    /** Draws an irrigation from the deck. */
14
    public void draw() {
15 2 1. draw : changed conditional boundary → TIMED_OUT
2. draw : negated conditional → KILLED
        if (size <= 0) {
16
            throw new IllegalArgumentException("No more irrigation");
17
        }
18 1 1. draw : Replaced integer subtraction with addition → KILLED
        size--;
19
    }
20
21
    /**
22
     * @return true if the deck has irrigation, false otherwise
23
     */
24
    public boolean hasIrrigation() {
25 3 1. hasIrrigation : changed conditional boundary → TIMED_OUT
2. hasIrrigation : replaced boolean return with true for com/takenoko/asset/IrrigationDeck::hasIrrigation → TIMED_OUT
3. hasIrrigation : negated conditional → KILLED
        return size > 0;
26
    }
27
28
    /**
29
     * @return the number of irrigation left in the deck
30
     */
31
    public int getSize() {
32 1 1. getSize : replaced int return with 0 for com/takenoko/asset/IrrigationDeck::getSize → KILLED
        return size;
33
    }
34
35
    @Override
36
    public boolean equals(Object o) {
37 2 1. equals : negated conditional → SURVIVED
2. equals : replaced boolean return with false for com/takenoko/asset/IrrigationDeck::equals → NO_COVERAGE
        if (this == o) return true;
38 3 1. equals : replaced boolean return with true for com/takenoko/asset/IrrigationDeck::equals → NO_COVERAGE
2. equals : negated conditional → KILLED
3. equals : negated conditional → KILLED
        if (o == null || getClass() != o.getClass()) return false;
39
40
        IrrigationDeck that = (IrrigationDeck) o;
41
42 2 1. equals : replaced boolean return with true for com/takenoko/asset/IrrigationDeck::equals → SURVIVED
2. equals : negated conditional → KILLED
        return size == that.size;
43
    }
44
45
    @Override
46
    public int hashCode() {
47 1 1. hashCode : replaced int return with 0 for com/takenoko/asset/IrrigationDeck::hashCode → TIMED_OUT
        return size;
48
    }
49
50
    @Override
51
    public String toString() {
52 1 1. toString : replaced return value with "" for com/takenoko/asset/IrrigationDeck::toString → NO_COVERAGE
        return "IrrigationDeck{" + "size=" + size + '}';
53
    }
54
}

Mutations

15

1.1
Location : draw
Killed by : none
changed conditional boundary → TIMED_OUT

2.2
Location : draw
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:draw()]
negated conditional → KILLED

18

1.1
Location : draw
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:draw()]
Replaced integer subtraction with addition → KILLED

25

1.1
Location : hasIrrigation
Killed by : none
changed conditional boundary → TIMED_OUT

2.2
Location : hasIrrigation
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:hasIrrigation()]
negated conditional → KILLED

3.3
Location : hasIrrigation
Killed by : none
replaced boolean return with true for com/takenoko/asset/IrrigationDeck::hasIrrigation → TIMED_OUT

32

1.1
Location : getSize
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:draw()]
replaced int return with 0 for com/takenoko/asset/IrrigationDeck::getSize → KILLED

37

1.1
Location : equals
Killed by : none
negated conditional → SURVIVED

2.2
Location : equals
Killed by : none
replaced boolean return with false for com/takenoko/asset/IrrigationDeck::equals → NO_COVERAGE

38

1.1
Location : equals
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:equals()]
negated conditional → KILLED

2.2
Location : equals
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:equals()]
negated conditional → KILLED

3.3
Location : equals
Killed by : none
replaced boolean return with true for com/takenoko/asset/IrrigationDeck::equals → NO_COVERAGE

42

1.1
Location : equals
Killed by : com.takenoko.asset.IrrigationDeckTest.[engine:junit-jupiter]/[class:com.takenoko.asset.IrrigationDeckTest]/[method:equals()]
negated conditional → KILLED

2.2
Location : equals
Killed by : none
replaced boolean return with true for com/takenoko/asset/IrrigationDeck::equals → SURVIVED

47

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for com/takenoko/asset/IrrigationDeck::hashCode → TIMED_OUT

52

1.1
Location : toString
Killed by : none
replaced return value with "" for com/takenoko/asset/IrrigationDeck::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.8.0