ChooseIfApplyWeatherAction.java

1
package com.takenoko.actions.weather;
2
3
import com.takenoko.actions.Action;
4
import com.takenoko.actions.ActionResult;
5
import com.takenoko.actions.annotations.ActionAnnotation;
6
import com.takenoko.actions.annotations.ActionType;
7
import com.takenoko.engine.Board;
8
import com.takenoko.engine.BotManager;
9
import java.util.Objects;
10
11
/** Action to choose whether to apply the weather or not */
12
@ActionAnnotation(ActionType.FORCED)
13
public class ChooseIfApplyWeatherAction implements Action {
14
    private final boolean applyWeather;
15
16
    public ChooseIfApplyWeatherAction(boolean applyWeather) {
17
        this.applyWeather = applyWeather;
18
    }
19
20
    @Override
21
    public ActionResult execute(Board board, BotManager botManager) {
22 1 1. execute : negated conditional → KILLED
        if (applyWeather) {
23 1 1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT
            botManager.displayMessage(
24
                    botManager.getName() + " applied the weather " + board.peekWeather());
25 1 1. execute : replaced return value with null for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::execute → KILLED
            return new ActionResult(board.peekWeather().apply(board, botManager), 0);
26
        }
27 1 1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT
        botManager.displayMessage(
28
                botManager.getName() + " did not apply the weather " + board.peekWeather());
29 1 1. execute : replaced return value with null for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::execute → KILLED
        return new ActionResult(0);
30
    }
31
32
    @Override
33
    public boolean equals(Object o) {
34 2 1. equals : negated conditional → SURVIVED
2. equals : replaced boolean return with false for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → NO_COVERAGE
        if (this == o) return true;
35 3 1. equals : replaced boolean return with true for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → NO_COVERAGE
2. equals : negated conditional → KILLED
3. equals : negated conditional → KILLED
        if (o == null || getClass() != o.getClass()) return false;
36
        ChooseIfApplyWeatherAction that = (ChooseIfApplyWeatherAction) o;
37 2 1. equals : replaced boolean return with true for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → SURVIVED
2. equals : negated conditional → KILLED
        return applyWeather == that.applyWeather;
38
    }
39
40
    @Override
41
    public int hashCode() {
42 1 1. hashCode : replaced int return with 0 for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::hashCode → TIMED_OUT
        return Objects.hash(applyWeather);
43
    }
44
}

Mutations

22

1.1
Location : execute
Killed by : com.takenoko.actions.weather.ChooseIfApplyWeatherActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.weather.ChooseIfApplyWeatherActionTest]/[nested-class:Execute]/[method:shouldApplyTheWeatherIfApplyWeatherIsTrue()]
negated conditional → KILLED

23

1.1
Location : execute
Killed by : none
removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT

25

1.1
Location : execute
Killed by : com.takenoko.actions.weather.ChooseIfApplyWeatherActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.weather.ChooseIfApplyWeatherActionTest]/[nested-class:Execute]/[method:shouldReturnAnActionResult()]
replaced return value with null for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::execute → KILLED

27

1.1
Location : execute
Killed by : none
removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT

29

1.1
Location : execute
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/actions/weather/ChooseIfApplyWeatherAction::execute → KILLED

34

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/actions/weather/ChooseIfApplyWeatherAction::equals → NO_COVERAGE

35

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

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

3.3
Location : equals
Killed by : none
replaced boolean return with true for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → NO_COVERAGE

37

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

2.2
Location : equals
Killed by : none
replaced boolean return with true for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → SURVIVED

42

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::hashCode → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.8.0