GameAssets.java

1
package com.takenoko.asset;
2
3
import com.takenoko.objective.Objective;
4
import com.takenoko.objective.ObjectiveType;
5
import com.takenoko.weather.WeatherDice;
6
import java.util.List;
7
import java.util.Objects;
8
9
public class GameAssets {
10
    private final WeatherDice weatherDice;
11
    private final ImprovementDeck improvementDeck;
12
    private final TileDeck tileDeck;
13
    private final ObjectiveDeck objectiveDeck;
14
15
    private final IrrigationDeck irrigationDeck;
16
17
    public GameAssets() {
18
        this(new WeatherDice(), new ImprovementDeck());
19
    }
20
21
    public GameAssets(WeatherDice weatherDice) {
22
        this(weatherDice, new ImprovementDeck());
23
    }
24
25
    public GameAssets(WeatherDice weatherDice, TileDeck tileDeck) {
26
        this(
27
                weatherDice,
28
                new ImprovementDeck(),
29
                tileDeck,
30
                new IrrigationDeck(),
31
                new ObjectiveDeck());
32
    }
33
34
    public GameAssets(
35
            WeatherDice weatherDice,
36
            ImprovementDeck improvementDeck,
37
            TileDeck tileDeck,
38
            IrrigationDeck irrigationDeck,
39
            ObjectiveDeck objectiveDeck) {
40
        this.weatherDice = weatherDice;
41
        this.improvementDeck = improvementDeck;
42
        this.tileDeck = tileDeck;
43
        this.objectiveDeck = objectiveDeck;
44
        this.irrigationDeck = irrigationDeck;
45
    }
46
47
    public GameAssets(WeatherDice weatherDice, ImprovementDeck improvementDeck) {
48
        this.weatherDice = weatherDice;
49
        this.improvementDeck = improvementDeck;
50
        this.tileDeck = new TileDeck();
51
        this.objectiveDeck = new ObjectiveDeck();
52
        this.irrigationDeck = new IrrigationDeck();
53
    }
54
55
    public GameAssets(GameAssets gameAssets) {
56
        this(
57
                gameAssets.weatherDice,
58
                gameAssets.improvementDeck,
59
                gameAssets.tileDeck,
60
                gameAssets.irrigationDeck,
61
                gameAssets.objectiveDeck);
62
    }
63
64
    /**
65
     * @return the weather dice used by all bots
66
     */
67
    public WeatherDice getWeatherDice() {
68 1 1. getWeatherDice : replaced return value with null for com/takenoko/asset/GameAssets::getWeatherDice → KILLED
        return weatherDice;
69
    }
70
71
    /**
72
     * @return the improvement deck used by all bots
73
     */
74
    public ImprovementDeck getImprovementDeck() {
75 1 1. getImprovementDeck : replaced return value with null for com/takenoko/asset/GameAssets::getImprovementDeck → KILLED
        return improvementDeck;
76
    }
77
78
    public IrrigationDeck getIrrigationDeck() {
79 1 1. getIrrigationDeck : replaced return value with null for com/takenoko/asset/GameAssets::getIrrigationDeck → KILLED
        return irrigationDeck;
80
    }
81
82
    public GameAssets copy() {
83 1 1. copy : replaced return value with null for com/takenoko/asset/GameAssets::copy → KILLED
        return new GameAssets(this);
84
    }
85
86
    public TileDeck getTileDeck() {
87 1 1. getTileDeck : replaced return value with null for com/takenoko/asset/GameAssets::getTileDeck → KILLED
        return tileDeck;
88
    }
89
90
    public ObjectiveDeck getObjectiveDeck() {
91 1 1. getObjectiveDeck : replaced return value with null for com/takenoko/asset/GameAssets::getObjectiveDeck → KILLED
        return objectiveDeck;
92
    }
93
94
    @Override
95
    public boolean equals(Object o) {
96 2 1. equals : negated conditional → KILLED
2. equals : replaced boolean return with false for com/takenoko/asset/GameAssets::equals → KILLED
        if (this == o) return true;
97 3 1. equals : negated conditional → KILLED
2. equals : negated conditional → KILLED
3. equals : replaced boolean return with true for com/takenoko/asset/GameAssets::equals → KILLED
        if (o == null || getClass() != o.getClass()) return false;
98
        GameAssets that = (GameAssets) o;
99 2 1. equals : negated conditional → KILLED
2. equals : replaced boolean return with true for com/takenoko/asset/GameAssets::equals → KILLED
        return Objects.equals(weatherDice, that.weatherDice)
100 1 1. equals : negated conditional → KILLED
                && Objects.equals(improvementDeck, that.improvementDeck)
101 1 1. equals : negated conditional → KILLED
                && Objects.equals(tileDeck, that.tileDeck)
102 1 1. equals : negated conditional → KILLED
                && Objects.equals(objectiveDeck, that.objectiveDeck)
103 1 1. equals : negated conditional → KILLED
                && Objects.equals(irrigationDeck, that.irrigationDeck);
104
    }
105
106
    @Override
107
    public int hashCode() {
108 1 1. hashCode : replaced int return with 0 for com/takenoko/asset/GameAssets::hashCode → KILLED
        return Objects.hash(weatherDice, improvementDeck, tileDeck, objectiveDeck, irrigationDeck);
109
    }
110
111
    /**
112
     * Return the list of objectives for the starting deck
113
     *
114
     * @return list of objectives
115
     */
116
    public List<Objective> getStarterDeck() {
117 1 1. getStarterDeck : replaced return value with Collections.emptyList for com/takenoko/asset/GameAssets::getStarterDeck → TIMED_OUT
        return objectiveDeck.getStarterDeck();
118
    }
119
120
    public boolean hasObjectiveTypeInDeck(ObjectiveType objectiveType) {
121 2 1. hasObjectiveTypeInDeck : replaced boolean return with false for com/takenoko/asset/GameAssets::hasObjectiveTypeInDeck → KILLED
2. hasObjectiveTypeInDeck : replaced boolean return with true for com/takenoko/asset/GameAssets::hasObjectiveTypeInDeck → KILLED
        return objectiveDeck.hasObjectiveType(objectiveType);
122
    }
123
}

Mutations

68

1.1
Location : getWeatherDice
Killed by : com.takenoko.bot.utils.HistoryAnalysisTest.[engine:junit-jupiter]/[class:com.takenoko.bot.utils.HistoryAnalysisTest]/[nested-class:IntegrationTest]/[method:test1()]
replaced return value with null for com/takenoko/asset/GameAssets::getWeatherDice → KILLED

75

1.1
Location : getImprovementDeck
Killed by : com.takenoko.bot.utils.HistoryAnalysisTest.[engine:junit-jupiter]/[class:com.takenoko.bot.utils.HistoryAnalysisTest]/[nested-class:IntegrationTest]/[method:test1()]
replaced return value with null for com/takenoko/asset/GameAssets::getImprovementDeck → KILLED

79

1.1
Location : getIrrigationDeck
Killed by : com.takenoko.engine.GameEngineTest.[engine:junit-jupiter]/[class:com.takenoko.engine.GameEngineTest]/[nested-class:TestRunGame]/[method:runGame_shouldDisplayALotOfMessages()]
replaced return value with null for com/takenoko/asset/GameAssets::getIrrigationDeck → KILLED

83

1.1
Location : copy
Killed by : com.takenoko.asset.GameAssetsTest.[engine:junit-jupiter]/[class:com.takenoko.asset.GameAssetsTest]/[nested-class:TestCopy]/[method:copy_WhenGameAssetsIsCopied_ThenReturnsNewGameAssets()]
replaced return value with null for com/takenoko/asset/GameAssets::copy → KILLED

87

1.1
Location : getTileDeck
Killed by : com.takenoko.layers.irrigation.IrrigationLayerTest.[engine:junit-jupiter]/[class:com.takenoko.layers.irrigation.IrrigationLayerTest]/[nested-class:TestPlaceIrrigation]/[method:placeIrrigationShouldUpdateIrrigationMap()]
replaced return value with null for com/takenoko/asset/GameAssets::getTileDeck → KILLED

91

1.1
Location : getObjectiveDeck
Killed by : com.takenoko.engine.GameEngineTest.[engine:junit-jupiter]/[class:com.takenoko.engine.GameEngineTest]/[nested-class:TestRunGame]/[method:runGame_shouldDisplayALotOfMessages()]
replaced return value with null for com/takenoko/asset/GameAssets::getObjectiveDeck → KILLED

96

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

2.2
Location : equals
Killed by : com.takenoko.asset.GameAssetsTest.[engine:junit-jupiter]/[class:com.takenoko.asset.GameAssetsTest]/[nested-class:TestEquals]/[method:EqualsWithItselfIsTrue()]
replaced boolean return with false for com/takenoko/asset/GameAssets::equals → KILLED

97

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

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

3.3
Location : equals
Killed by : com.takenoko.asset.GameAssetsTest.[engine:junit-jupiter]/[class:com.takenoko.asset.GameAssetsTest]/[nested-class:TestEquals]/[method:equals_WhenGameAssetsIsNull_ThenReturnsFalse()]
replaced boolean return with true for com/takenoko/asset/GameAssets::equals → KILLED

99

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

2.2
Location : equals
Killed by : com.takenoko.asset.GameAssetsTest.[engine:junit-jupiter]/[class:com.takenoko.asset.GameAssetsTest]/[nested-class:TestEquals]/[method:equals_WhenGameAssetsAreNotEqual_ThenReturnsFalse()]
replaced boolean return with true for com/takenoko/asset/GameAssets::equals → KILLED

100

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

101

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

102

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

103

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

108

1.1
Location : hashCode
Killed by : com.takenoko.asset.GameAssetsTest.[engine:junit-jupiter]/[class:com.takenoko.asset.GameAssetsTest]/[nested-class:TestHashCode]/[method:hashCode_WhenGameAssets_S_AreNotEqual_ThenReturnsDifferentHashCode()]
replaced int return with 0 for com/takenoko/asset/GameAssets::hashCode → KILLED

117

1.1
Location : getStarterDeck
Killed by : none
replaced return value with Collections.emptyList for com/takenoko/asset/GameAssets::getStarterDeck → TIMED_OUT

121

1.1
Location : hasObjectiveTypeInDeck
Killed by : com.takenoko.bot.ColletBotTest.[engine:junit-jupiter]/[class:com.takenoko.bot.ColletBotTest]/[nested-class:IntegrationTests]/[method:whenTheBotChoosesAnObjectiveItTakesThePandaOnesIfThereAreSomeAvailables()]
replaced boolean return with false for com/takenoko/asset/GameAssets::hasObjectiveTypeInDeck → KILLED

2.2
Location : hasObjectiveTypeInDeck
Killed by : com.takenoko.bot.utils.HistoryAnalysisTest.[engine:junit-jupiter]/[class:com.takenoko.bot.utils.HistoryAnalysisTest]/[nested-class:IntegrationTest]/[method:test1()]
replaced boolean return with true for com/takenoko/asset/GameAssets::hasObjectiveTypeInDeck → KILLED

Active mutators

Tests examined


Report generated by PIT 1.8.0