LayerBambooStack.java

1
package com.takenoko.layers.bamboo;
2
3
public class LayerBambooStack extends BambooStack {
4
    public static final int MAX_BAMBOO = 4;
5
6
    public LayerBambooStack(int startingBamboo) {
7
        super(startingBamboo);
8
    }
9
10
    @Override
11
    protected void growBamboo() {
12 2 1. growBamboo : changed conditional boundary → KILLED
2. growBamboo : negated conditional → KILLED
        if (bambooCount >= MAX_BAMBOO) {
13
            throw new IllegalArgumentException("There is no more room for bamboo");
14
        }
15 1 1. growBamboo : Replaced integer addition with subtraction → KILLED
        bambooCount++;
16
    }
17
18
    @Override
19
    protected void eatBamboo() {
20 1 1. eatBamboo : negated conditional → KILLED
        if (bambooCount == 0) {
21
            throw new IllegalArgumentException("There is no bamboo to remove");
22
        }
23 1 1. eatBamboo : Replaced integer subtraction with addition → KILLED
        bambooCount--;
24
    }
25
26
    /*
27
     * @return if the bamboo can grow
28
     */
29
    public boolean isGrowable() {
30 3 1. isGrowable : changed conditional boundary → KILLED
2. isGrowable : negated conditional → KILLED
3. isGrowable : replaced boolean return with true for com/takenoko/layers/bamboo/LayerBambooStack::isGrowable → KILLED
        return bambooCount < MAX_BAMBOO;
31
    }
32
33
    /*
34
     * @return if the bamboo can be eaten
35
     */
36
    public boolean isEatable() {
37 3 1. isEatable : changed conditional boundary → KILLED
2. isEatable : negated conditional → KILLED
3. isEatable : replaced boolean return with true for com/takenoko/layers/bamboo/LayerBambooStack::isEatable → KILLED
        return bambooCount > 0;
38
    }
39
40
    @Override
41
    public LayerBambooStack copy() {
42 1 1. copy : replaced return value with null for com/takenoko/layers/bamboo/LayerBambooStack::copy → KILLED
        return new LayerBambooStack(this.getBambooCount());
43
    }
44
}

Mutations

12

1.1
Location : growBamboo
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestAddBamboo]/[method:shouldThrowAnExceptionIfTheBamboostackIsFull()]
changed conditional boundary → KILLED

2.2
Location : growBamboo
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestAddBamboo]/[method:shouldAddABamboo()]
negated conditional → KILLED

15

1.1
Location : growBamboo
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestAddBamboo]/[method:shouldAddABamboo()]
Replaced integer addition with subtraction → KILLED

20

1.1
Location : eatBamboo
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestRemoveBamboo]/[method:shouldThrowAnExceptionIfThereIsNoBamboo()]
negated conditional → KILLED

23

1.1
Location : eatBamboo
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestRemoveBamboo]/[method:shouldRemoveABamboo()]
Replaced integer subtraction with addition → KILLED

30

1.1
Location : isGrowable
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestIsGrowable]/[method:shouldReturnFalseIfTheBambooStackIsFull()]
changed conditional boundary → KILLED

2.2
Location : isGrowable
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestIsGrowable]/[method:shouldReturnFalseIfTheBambooStackIsFull()]
negated conditional → KILLED

3.3
Location : isGrowable
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestIsGrowable]/[method:shouldReturnFalseIfTheBambooStackIsFull()]
replaced boolean return with true for com/takenoko/layers/bamboo/LayerBambooStack::isGrowable → KILLED

37

1.1
Location : isEatable
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestIsEatable]/[method:shouldReturnFalseIfTheBambooStackIsEmpty()]
changed conditional boundary → KILLED

2.2
Location : isEatable
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestIsEatable]/[method:shouldReturnFalseIfTheBambooStackIsEmpty()]
negated conditional → KILLED

3.3
Location : isEatable
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestIsEatable]/[method:shouldReturnFalseIfTheBambooStackIsEmpty()]
replaced boolean return with true for com/takenoko/layers/bamboo/LayerBambooStack::isEatable → KILLED

42

1.1
Location : copy
Killed by : com.takenoko.layers.bamboo.LayerBambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.LayerBambooStackTest]/[nested-class:TestCopy]/[method:shouldReturnACopyOfTheBambooStack()]
replaced return value with null for com/takenoko/layers/bamboo/LayerBambooStack::copy → KILLED

Active mutators

Tests examined


Report generated by PIT 1.8.0