From 8c78ddad40fe4fbb100dcca5d9706745613bd581 Mon Sep 17 00:00:00 2001 From: asvitkine Date: Wed, 12 Jul 2023 19:46:14 -0400 Subject: [PATCH] More test fixes. --- .../battle/steps/BattleStepsTest.java | 3 +++ .../FiringGroupSplitterGeneralTest.java | 20 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/BattleStepsTest.java b/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/BattleStepsTest.java index 01f83471b18..c5033e620eb 100644 --- a/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/BattleStepsTest.java +++ b/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/BattleStepsTest.java @@ -1017,6 +1017,7 @@ void defendingFirstStrikeWithSneakAttackAllowed() { givenBattleStateBuilder() .gameData( givenGameData() + .withCaptureUnitsOnEnteringTerritory(false) .withSubRetreatBeforeBattle(false) .withDefendingSuicideAndMunitionUnitsDoNotFire(false) .withAlliedAirIndependent(true) @@ -1621,6 +1622,7 @@ void defendingFirstStrikeCanSubmergeIfSubmersibleSubs() { givenBattleStateBuilder() .gameData( givenGameData() + .withCaptureUnitsOnEnteringTerritory(false) .withSubRetreatBeforeBattle(false) .withDefendingSuicideAndMunitionUnitsDoNotFire(false) .withAlliedAirIndependent(true) @@ -2013,6 +2015,7 @@ void partialAmphibiousAttackCanNotWithdrawIfHasAllAmphibious() { givenBattleStateBuilder() .gameData( givenGameData() + .withCaptureUnitsOnEnteringTerritory(false) .withSubRetreatBeforeBattle(false) .withWW2V2(false) .withAlliedAirIndependent(true) diff --git a/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/fire/general/FiringGroupSplitterGeneralTest.java b/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/fire/general/FiringGroupSplitterGeneralTest.java index 29b0d4721f6..5698d818733 100644 --- a/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/fire/general/FiringGroupSplitterGeneralTest.java +++ b/game-app/game-core/src/test/java/games/strategy/triplea/delegate/battle/steps/fire/general/FiringGroupSplitterGeneralTest.java @@ -22,6 +22,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import games.strategy.engine.data.GameData; import games.strategy.engine.data.GamePlayer; import games.strategy.engine.data.Unit; import games.strategy.engine.data.UnitType; @@ -29,6 +30,7 @@ import games.strategy.triplea.delegate.battle.steps.fire.FiringGroup; import java.util.List; import java.util.Set; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -40,6 +42,16 @@ class FiringGroupSplitterGeneralTest { @Mock GamePlayer attacker; @Mock GamePlayer defender; + @BeforeEach + void setUp() { + final GameData gameData = new GameData(); + + lenient().when(attacker.getName()).thenReturn("attacker"); + lenient().when(attacker.getData()).thenReturn(gameData); + lenient().when(defender.getName()).thenReturn("defender"); + lenient().when(defender.getData()).thenReturn(gameData); + } + @Test void oneFiringUnitVsOneTargetableUnitMakesOneFiringGroup() { final Unit targetUnit = givenAnyUnit(); @@ -216,14 +228,6 @@ void doNotExcludeUnitsOfAlliesIfAlliedAirIndependentIsFalseButItIsDefense() { assertThat(firingGroups.get(0).getFiringUnits(), contains(fireUnit, fireUnit2)); assertThat(firingGroups.get(0).getTargetUnits(), contains(targetUnit)); assertThat(firingGroups.get(0).isSuicideOnHit(), is(false)); - - verify( - fireUnit, - never() - .description( - "Units on defense with AlliedAirIndependent == false" - + "should never call getOwner")) - .getOwner(); } @Test