PlaceIrrigationFromInventoryAction.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.ActionCanBePlayedMultipleTimesPerTurn;
7
import com.takenoko.actions.annotations.ActionType;
8
import com.takenoko.engine.Board;
9
import com.takenoko.engine.BotManager;
10
import com.takenoko.engine.BotState;
11
import com.takenoko.layers.irrigation.EdgePosition;
12
import java.util.Objects;
13
14
@ActionAnnotation(ActionType.DEFAULT)
15
@ActionCanBePlayedMultipleTimesPerTurn
16
public class PlaceIrrigationFromInventoryAction implements DefaultAction {
17
    final EdgePosition positionVector;
18
19
    public PlaceIrrigationFromInventoryAction(EdgePosition positionVector) {
20
        this.positionVector = positionVector;
21
    }
22
23
    @Override
24
    public ActionResult execute(Board board, BotManager botManager) {
25 1 1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT
        botManager.displayMessage(
26
                botManager.getName()
27
                        + " placed irrigation at "
28
                        + positionVector
29
                        + " from inventory");
30 1 1. execute : removed call to com/takenoko/inventory/Inventory::useIrrigationChannel → KILLED
        botManager.getInventory().useIrrigationChannel();
31 1 1. execute : removed call to com/takenoko/engine/Board::placeIrrigation → KILLED
        board.placeIrrigation(positionVector);
32 1 1. execute : replaced return value with null for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::execute → KILLED
        return new ActionResult(0);
33
    }
34
35
    public static boolean canBePlayed(Board board, BotState botState) {
36 3 1. canBePlayed : changed conditional boundary → TIMED_OUT
2. canBePlayed : negated conditional → TIMED_OUT
3. canBePlayed : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::canBePlayed → KILLED
        return botState.getInventory().getIrrigationChannelsCount() > 0
37 1 1. canBePlayed : negated conditional → TIMED_OUT
                && !board.getAvailableIrrigationPositions().isEmpty();
38
    }
39
40
    @Override
41
    public boolean equals(Object o) {
42 2 1. equals : negated conditional → NO_COVERAGE
2. equals : replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE
        if (this == o) return true;
43 3 1. equals : negated conditional → NO_COVERAGE
2. equals : negated conditional → NO_COVERAGE
3. equals : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE
        if (o == null || getClass() != o.getClass()) return false;
44
        PlaceIrrigationFromInventoryAction that = (PlaceIrrigationFromInventoryAction) o;
45 2 1. equals : replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE
2. equals : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE
        return Objects.equals(positionVector, that.positionVector);
46
    }
47
48
    @Override
49
    public int hashCode() {
50 1 1. hashCode : replaced int return with 0 for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::hashCode → TIMED_OUT
        return Objects.hash(positionVector);
51
    }
52
}

Mutations

25

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

30

1.1
Location : execute
Killed by : com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryActionTest]/[nested-class:TestExecute]/[method:shouldReturnAnActionResult()]
removed call to com/takenoko/inventory/Inventory::useIrrigationChannel → KILLED

31

1.1
Location : execute
Killed by : com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryActionTest]/[nested-class:TestExecute]/[method:shouldReturnAnActionResult()]
removed call to com/takenoko/engine/Board::placeIrrigation → KILLED

32

1.1
Location : execute
Killed by : com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryActionTest]/[nested-class:TestExecute]/[method:shouldReturnAnActionResult()]
replaced return value with null for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::execute → KILLED

36

1.1
Location : canBePlayed
Killed by : none
changed conditional boundary → TIMED_OUT

2.2
Location : canBePlayed
Killed by : none
negated conditional → TIMED_OUT

3.3
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/PlaceIrrigationFromInventoryAction::canBePlayed → KILLED

37

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

42

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE

43

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

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

45

1.1
Location : equals
Killed by : none
replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE

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

50

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

Active mutators

Tests examined


Report generated by PIT 1.8.0