DrawIrrigationAction.java

1
package com.takenoko.actions.irrigation;
2
3
import com.takenoko.actions.ActionResult;
4
import com.takenoko.actions.DefaultAction;
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.List;
10
11
@ActionAnnotation(ActionType.DEFAULT)
12
public class DrawIrrigationAction implements DefaultAction {
13
14
    public static boolean canBePlayed(Board board) {
15 2 1. canBePlayed : replaced boolean return with false for com/takenoko/actions/irrigation/DrawIrrigationAction::canBePlayed → TIMED_OUT
2. canBePlayed : replaced boolean return with true for com/takenoko/actions/irrigation/DrawIrrigationAction::canBePlayed → KILLED
        return board.hasIrrigation();
16
    }
17
18
    @Override
19
    public ActionResult execute(Board board, BotManager botManager) {
20 1 1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT
        botManager.displayMessage(botManager.getName() + " drew irrigation");
21 1 1. execute : removed call to com/takenoko/engine/Board::drawIrrigation → TIMED_OUT
        board.drawIrrigation();
22 1 1. execute : removed call to com/takenoko/inventory/Inventory::collectIrrigationChannel → TIMED_OUT
        botManager.getInventory().collectIrrigationChannel();
23 1 1. execute : negated conditional → TIMED_OUT
        if (!board.getAvailableIrrigationPositions().isEmpty()) {
24 1 1. execute : replaced return value with null for com/takenoko/actions/irrigation/DrawIrrigationAction::execute → KILLED
            return new ActionResult(
25
                    List.of(PlaceIrrigationAction.class, StoreIrrigationInInventoryAction.class),
26
                    0);
27
        }
28 1 1. execute : replaced return value with null for com/takenoko/actions/irrigation/DrawIrrigationAction::execute → KILLED
        return new ActionResult(List.of(StoreIrrigationInInventoryAction.class), 0);
29
    }
30
31
    @Override
32
    public boolean equals(Object o) {
33 2 1. equals : replaced boolean return with true for com/takenoko/actions/irrigation/DrawIrrigationAction::equals → SURVIVED
2. equals : replaced boolean return with false for com/takenoko/actions/irrigation/DrawIrrigationAction::equals → KILLED
        return o instanceof DrawIrrigationAction;
34
    }
35
36
    @Override
37
    public int hashCode() {
38 1 1. hashCode : replaced int return with 0 for com/takenoko/actions/irrigation/DrawIrrigationAction::hashCode → TIMED_OUT
        return this.getClass().hashCode();
39
    }
40
}

Mutations

15

1.1
Location : canBePlayed
Killed by : none
replaced boolean return with false for com/takenoko/actions/irrigation/DrawIrrigationAction::canBePlayed → TIMED_OUT

2.2
Location : canBePlayed
Killed by : com.takenoko.engine.BotStateTest.[engine:junit-jupiter]/[class:com.takenoko.engine.BotStateTest]/[nested-class:TestUpdateAvailableActions]/[method:updateAvailableActions_shouldNotRemoveAlreadyExecutedActionsIfWindy()]
replaced boolean return with true for com/takenoko/actions/irrigation/DrawIrrigationAction::canBePlayed → KILLED

20

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

21

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

22

1.1
Location : execute
Killed by : none
removed call to com/takenoko/inventory/Inventory::collectIrrigationChannel → TIMED_OUT

23

1.1
Location : execute
Killed by : none
negated conditional → TIMED_OUT

24

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/irrigation/DrawIrrigationAction::execute → KILLED

28

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

33

1.1
Location : equals
Killed by : com.takenoko.bot.unitary.SmartDrawIrrigationTest.[engine:junit-jupiter]/[class:com.takenoko.bot.unitary.SmartDrawIrrigationTest]/[nested-class:FillAction]/[method:shouldDrawAnIrrigationWhenThereIsLessThan3IrrigationInTheInventory()]
replaced boolean return with false for com/takenoko/actions/irrigation/DrawIrrigationAction::equals → KILLED

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

38

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

Active mutators

Tests examined


Report generated by PIT 1.8.0