1
|
|
package com.takenoko.layers.bamboo; |
2
|
|
|
3
|
|
import java.util.Objects; |
4
|
|
|
5
|
|
public class BambooStack { |
6
|
|
protected int bambooCount; |
7
|
|
|
8
|
|
public BambooStack(int startingBamboo) { |
9
|
|
bambooCount = startingBamboo; |
10
|
|
} |
11
|
|
|
12
|
|
public BambooStack(BambooStack bambooStack) { |
13
|
|
this(bambooStack.bambooCount); |
14
|
|
} |
15
|
|
|
16
|
|
/** increment bambooCount by 1 */ |
17
|
|
protected void growBamboo() { |
18
|
1
1. growBamboo : removed call to com/takenoko/layers/bamboo/BambooStack::growBamboo → KILLED
|
this.growBamboo(1); |
19
|
|
} |
20
|
|
|
21
|
|
/** increment bambooCount by height */ |
22
|
|
protected void growBamboo(int height) { |
23
|
1
1. growBamboo : Replaced integer addition with subtraction → KILLED
|
bambooCount += height; |
24
|
|
} |
25
|
|
|
26
|
|
/** lower bambooCount by 1 */ |
27
|
|
protected void eatBamboo() { |
28
|
1
1. eatBamboo : negated conditional → KILLED
|
if (bambooCount == 0) { |
29
|
|
throw new IllegalArgumentException("There is no bamboo to remove"); |
30
|
|
} |
31
|
1
1. eatBamboo : Replaced integer subtraction with addition → KILLED
|
bambooCount--; |
32
|
|
} |
33
|
|
|
34
|
|
/** |
35
|
|
* @return number of bamboos |
36
|
|
*/ |
37
|
|
public int getBambooCount() { |
38
|
1
1. getBambooCount : replaced int return with 0 for com/takenoko/layers/bamboo/BambooStack::getBambooCount → KILLED
|
return bambooCount; |
39
|
|
} |
40
|
|
|
41
|
|
@Override |
42
|
|
public boolean equals(Object o) { |
43
|
2
1. equals : negated conditional → KILLED
2. equals : replaced boolean return with false for com/takenoko/layers/bamboo/BambooStack::equals → KILLED
|
if (this == o) return true; |
44
|
3
1. equals : negated conditional → KILLED
2. equals : negated conditional → KILLED
3. equals : replaced boolean return with true for com/takenoko/layers/bamboo/BambooStack::equals → KILLED
|
if (o == null || getClass() != o.getClass()) return false; |
45
|
|
BambooStack that = (BambooStack) o; |
46
|
2
1. equals : negated conditional → KILLED
2. equals : replaced boolean return with true for com/takenoko/layers/bamboo/BambooStack::equals → KILLED
|
return getBambooCount() == that.getBambooCount(); |
47
|
|
} |
48
|
|
|
49
|
|
@Override |
50
|
|
public int hashCode() { |
51
|
1
1. hashCode : replaced int return with 0 for com/takenoko/layers/bamboo/BambooStack::hashCode → KILLED
|
return Objects.hash(getBambooCount()); |
52
|
|
} |
53
|
|
|
54
|
|
public BambooStack copy() { |
55
|
1
1. copy : replaced return value with null for com/takenoko/layers/bamboo/BambooStack::copy → KILLED
|
return new BambooStack(this); |
56
|
|
} |
57
|
|
|
58
|
|
/** |
59
|
|
* @return true if bambooCount is 0 |
60
|
|
*/ |
61
|
|
public boolean isEmpty() { |
62
|
2
1. isEmpty : negated conditional → KILLED
2. isEmpty : replaced boolean return with true for com/takenoko/layers/bamboo/BambooStack::isEmpty → KILLED
|
return bambooCount == 0; |
63
|
|
} |
64
|
|
|
65
|
|
/** reset bamboo counter to value 0 */ |
66
|
|
public void clear() { |
67
|
|
bambooCount = 0; |
68
|
|
} |
69
|
|
|
70
|
|
public void useBamboo(Integer count) { |
71
|
2
1. useBamboo : changed conditional boundary → TIMED_OUT
2. useBamboo : negated conditional → KILLED
|
if (count > bambooCount) { |
72
|
|
throw new IllegalArgumentException("Not enough bamboo to use"); |
73
|
|
} |
74
|
1
1. useBamboo : Replaced integer subtraction with addition → TIMED_OUT
|
bambooCount -= count; |
75
|
|
} |
76
|
|
} |
| | Mutations |
18 |
|
1.1 Location : growBamboo Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestAddBamboo]/[method:shouldAddABamboo()] removed call to com/takenoko/layers/bamboo/BambooStack::growBamboo → KILLED
|
23 |
|
1.1 Location : growBamboo Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestAddBamboo]/[method:shouldAddABamboo()] Replaced integer addition with subtraction → KILLED
|
28 |
|
1.1 Location : eatBamboo Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestRemoveBamboo]/[method:shouldRemoveABamboo()] negated conditional → KILLED
|
31 |
|
1.1 Location : eatBamboo Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestRemoveBamboo]/[method:shouldRemoveABamboo()] Replaced integer subtraction with addition → KILLED
|
38 |
|
1.1 Location : getBambooCount Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestHashCode]/[method:shouldReturnADifferentHashcodeIfTheTwoObjectsAreNotEqual()] replaced int return with 0 for com/takenoko/layers/bamboo/BambooStack::getBambooCount → KILLED
|
43 |
|
1.1 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnFalseIfTheTwoObjectsAreOfDifferentClasses()] negated conditional → KILLED 2.2 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnTrueIfTheTwoObjectsAreTheSame()] replaced boolean return with false for com/takenoko/layers/bamboo/BambooStack::equals → KILLED
|
44 |
|
1.1 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnTrueIfTheTwoObjectsAreEqual()] negated conditional → KILLED 2.2 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnFalseIfTheTwoObjectsAreOfDifferentClasses()] negated conditional → KILLED 3.3 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnFalseIfTheTwoObjectsAreOfDifferentClasses()] replaced boolean return with true for com/takenoko/layers/bamboo/BambooStack::equals → KILLED
|
46 |
|
1.1 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnTrueIfTheTwoObjectsAreEqual()] negated conditional → KILLED 2.2 Location : equals Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestEquals]/[method:shouldReturnFalseIfTheTwoObjectsAreNotEqual()] replaced boolean return with true for com/takenoko/layers/bamboo/BambooStack::equals → KILLED
|
51 |
|
1.1 Location : hashCode Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestHashCode]/[method:shouldReturnADifferentHashcodeIfTheTwoObjectsAreNotEqual()] replaced int return with 0 for com/takenoko/layers/bamboo/BambooStack::hashCode → KILLED
|
55 |
|
1.1 Location : copy Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestCopy]/[method:shouldReturnACopyOfTheBambooStack()] replaced return value with null for com/takenoko/layers/bamboo/BambooStack::copy → KILLED
|
62 |
|
1.1 Location : isEmpty Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestIsEmpty]/[method:shouldReturnTrueWhenItIsEmpty()] negated conditional → KILLED 2.2 Location : isEmpty Killed by : com.takenoko.layers.bamboo.BambooStackTest.[engine:junit-jupiter]/[class:com.takenoko.layers.bamboo.BambooStackTest]/[nested-class:TestIsEmpty]/[method:shouldReturnFalseWhenItIsNotEmpty()] replaced boolean return with true for com/takenoko/layers/bamboo/BambooStack::isEmpty → KILLED
|
71 |
|
1.1 Location : useBamboo Killed by : none changed conditional boundary → TIMED_OUT 2.2 Location : useBamboo Killed by : com.takenoko.bot.utils.HistoryAnalysisTest.[engine:junit-jupiter]/[class:com.takenoko.bot.utils.HistoryAnalysisTest]/[nested-class:IntegrationTest]/[method:test1()] negated conditional → KILLED
|
74 |
|
1.1 Location : useBamboo Killed by : none Replaced integer subtraction with addition → TIMED_OUT
|