@Before public void setUp() { mockTarget = Mockito.mock(Targetable.class); testFiringPlan = Mockito.spy(new FiringPlan(mockTarget)); mockWeaponFireInfoMG = Mockito.mock(WeaponFireInfo.class); testFiringPlan.add(mockWeaponFireInfoMG); Mounted mockMG = Mockito.mock(Mounted.class); Mockito.when(mockWeaponFireInfoMG.getWeapon()).thenReturn(mockMG); mockWeaponAttackActionMG = Mockito.mock(WeaponAttackAction.class); Mockito.when(mockWeaponFireInfoMG.getWeaponAttackAction()).thenReturn(mockWeaponAttackActionMG); mockWeaponFireInfoPPC = Mockito.mock(WeaponFireInfo.class); testFiringPlan.add(mockWeaponFireInfoPPC); mockPPC = Mockito.mock(Mounted.class); Mockito.when(mockWeaponFireInfoPPC.getWeapon()).thenReturn(mockPPC); mockWeaponAttackActionPPC = Mockito.mock(WeaponAttackAction.class); Mockito.when(mockWeaponFireInfoPPC.getWeaponAttackAction()).thenReturn(mockWeaponAttackActionPPC); mockWeaponFireInfoERML = Mockito.mock(WeaponFireInfo.class); testFiringPlan.add(mockWeaponFireInfoERML); Mounted mockERML = Mockito.mock(Mounted.class); Mockito.when(mockWeaponFireInfoERML.getWeapon()).thenReturn(mockERML); mockWeaponAttackActionERML = Mockito.mock(WeaponAttackAction.class); Mockito.when(mockWeaponFireInfoERML.getWeaponAttackAction()).thenReturn(mockWeaponAttackActionERML); }
legAttack.add(weaponFireInfo); continue; } else if ((weaponFireInfo.getWeapon().getType()).getInternalName().equals(Infantry.SWARM_MEK)) { swarmAttack.add(weaponFireInfo); continue; fieldGuns.add(weaponFireInfo); fieldGunMassAlreadyFired += fieldGunMass; bestPlans[0].add(weaponFireInfo); } else { nonZeroHeatOptions.add(weaponFireInfo); testPlan.add(weaponFireInfo); calculateUtility(testPlan, heatTolerance, isAero);
testPlan.add(mockInfoLBX); testPlan.add(mockInfoLRM); testPlan.add(mockInfoLL); testPlan.add(mockInfoSRM); FiringPlan expectedOrder = new FiringPlan(mockTarget); expectedOrder.add(mockInfoLL); expectedOrder.add(mockInfoSRM); expectedOrder.add(mockInfoLBX); expectedOrder.add(mockInfoLRM); testPlan.sortPlan(); Assert.assertEquals("\nExpected: " + expectedOrder.getWeaponNames() + "\nActual : " + testPlan testPlan.add(mockInfoLBX); testPlan.add(mockInfoLRM); testPlan.add(mockInfoLL); testPlan.add(mockInfoSRM); expectedOrder = new FiringPlan(mockTarget); expectedOrder.add(mockInfoLBX); expectedOrder.add(mockInfoLL); expectedOrder.add(mockInfoSRM); expectedOrder.add(mockInfoLRM); testPlan.sortPlan(); Assert.assertEquals("\nExpected: " + expectedOrder.getWeaponNames() + "\nActual : " + testPlan
Mockito.when(mockPPCFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockPPCFireInfo.getDebugDescription()).thenReturn("mock PPC"); alphaStrike.add(mockPPCFireInfo); Mockito.when(mockMLFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockMLFireInfo.getDebugDescription()).thenReturn("mock ML"); alphaStrike.add(mockMLFireInfo); Mockito.when(mockLRMFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockLRMFireInfo.getDebugDescription()).thenReturn("mock LRM"); alphaStrike.add(mockLRMFireInfo); Mockito.when(mockMGFireInfo.getShooter()).thenReturn(mockShooter); Mockito.when(mockMGFireInfo.getDebugDescription()).thenReturn("mock MG"); alphaStrike.add(mockMGFireInfo); expected[0].add(mockMGFireInfo); expected[0].setUtility(1.2); expected[1] = new FiringPlan(mockTarget); expected[1].add(mockMGFireInfo); expected[1].add(mockLRMFireInfo); expected[1].setUtility(3.0); expected[2] = new FiringPlan(mockTarget); expected[2].add(mockMGFireInfo); expected[2].add(mockLRMFireInfo); expected[2].setUtility(3.0); expected[3] = new FiringPlan(mockTarget); expected[3].add(mockMGFireInfo); expected[3].add(mockMLFireInfo);
Mockito.when(mockLRMFireInfo.getExpectedDamage()).thenReturn(5.0); expected = new FiringPlan(mockTarget); expected.add(mockPPCFireInfo); expected.add(mockLRMFireInfo); final FiringPlan actual = testFireControl.guessFullAirToGroundPlan(mockShooter, mockTarget, mockTargetState, mockFlightPath, mockGame, true);
expected.add(mockPPCFireInfo); expected.add(mockLRMFireInfo); final FiringPlan actual = testFireControl.getFullFiringPlan(mockShooter, mockTarget, testToHitThreshold, mockGame); expected.add(mockPPCFireInfo); Assert.assertEquals(expected, testFireControl.getFullFiringPlan(mockShooter, mockTarget, testToHitThreshold, mockGame));
guess, bombPayload); diveBombPlan.add(diveBomb);
final WeaponFireInfo shoot = buildWeaponFireInfo(shooter, target, weapon, game, false); if ((shoot.getProbabilityToHit() > toHitThreshold)) { myPlan.add(shoot); continue;
aaa.setAmmoId(ammoID); actualFireInfo.setAction(aaa); retval.add(actualFireInfo); retval.setUtility(retval.getUtility() + maxDamage); owner.sendAmmoChange(shooter.getId(), shooter.getEquipmentNum(currentWeapon), ammoID); retval.add(tagInfo); retval.setUtility(retval.getUtility() + tagInfo.getProbabilityToHit());
myPlan.getHeat() + shoot.getHeat() + shooter.getHeat() <= shooter.getHeatCapacity() && 0 < shoot.getExpectedDamage()) { myPlan.add(shoot);
myPlan.add(shoot);