Objective.java

1
package com.takenoko.objective;
2
3
import com.takenoko.engine.Board;
4
import com.takenoko.engine.BotState;
5
6
public abstract class Objective {
7
8
    private final ObjectiveType type;
9
    ObjectiveState state;
10
    private final int points;
11
12
    protected Objective(ObjectiveType type, ObjectiveState state, int points) {
13
        this.type = type;
14
        this.state = state;
15
        this.points = points;
16
    }
17
18
    /** Verify state of the objective. */
19
    public abstract void verify(Board board, BotState botState);
20
21
    /**
22
     * Whether the objective has been achieved.
23
     *
24
     * @return if the objective is achieved.
25
     */
26
    public boolean isAchieved() {
27 2 1. isAchieved : negated conditional → KILLED
2. isAchieved : replaced boolean return with true for com/takenoko/objective/Objective::isAchieved → KILLED
        return state == ObjectiveState.ACHIEVED;
28
    }
29
30
    public ObjectiveType getType() {
31 1 1. getType : replaced return value with null for com/takenoko/objective/Objective::getType → KILLED
        return type;
32
    }
33
34
    public ObjectiveState getState() {
35 1 1. getState : replaced return value with null for com/takenoko/objective/Objective::getState → KILLED
        return state;
36
    }
37
38
    public abstract void reset();
39
40
    public abstract Objective copy();
41
42
    /*
43
     * @return the completion of the objective (between 0 and 1)
44
     */
45
    public abstract float getCompletion(Board board, BotState botState);
46
47
    public int getPoints() {
48 1 1. getPoints : replaced int return with 0 for com/takenoko/objective/Objective::getPoints → KILLED
        return points;
49
    }
50
}

Mutations

27

1.1
Location : isAchieved
Killed by : com.takenoko.objective.EmperorObjectiveTest.[engine:junit-jupiter]/[class:com.takenoko.objective.EmperorObjectiveTest]/[method:reset()]
negated conditional → KILLED

2.2
Location : isAchieved
Killed by : com.takenoko.objective.PandaObjectiveTest.[engine:junit-jupiter]/[class:com.takenoko.objective.PandaObjectiveTest]/[nested-class:TestVerify]/[method:verify_WhenObjectiveIsNotAchieved_ThenReturnsNOT_ACHIEVED()]
replaced boolean return with true for com/takenoko/objective/Objective::isAchieved → KILLED

31

1.1
Location : getType
Killed by : com.takenoko.bot.ColletBotTest.[engine:junit-jupiter]/[class:com.takenoko.bot.ColletBotTest]/[nested-class:IntegrationTests]/[method:whenTheBotChoosesAnObjectiveItTakesThePandaOnesIfThereAreSomeAvailables()]
replaced return value with null for com/takenoko/objective/Objective::getType → KILLED

35

1.1
Location : getState
Killed by : com.takenoko.objective.PatternObjectiveTest.[engine:junit-jupiter]/[class:com.takenoko.objective.PatternObjectiveTest]/[nested-class:TestVerify]/[method:verify_WhenBoardHasTwoTilesNextToEachOther_ThenObjectiveStateIsNOT_ACHIEVED()]
replaced return value with null for com/takenoko/objective/Objective::getState → KILLED

48

1.1
Location : getPoints
Killed by : com.takenoko.objective.EmperorObjectiveTest.[engine:junit-jupiter]/[class:com.takenoko.objective.EmperorObjectiveTest]/[method:givesTwoPoints()]
replaced int return with 0 for com/takenoko/objective/Objective::getPoints → KILLED

Active mutators

Tests examined


Report generated by PIT 1.8.0