GunDataManager extends EnemyDataManager<GunEnemy> { public void onBulletHitBullet(BulletHitBulletEvent e, long currentTime) { String botName = e.getHitBullet().getName(); for (GunEnemy gunData : getAllEnemyData()) { Wave hitWave = gunData.processBulletHit(e.getBullet(), currentTime, (_enemiesTotal == 1), botName.equals(gunData.botName)); if (hitWave != null) { hitWave.bulletHitBullet = true; } } if (!hasEnemy(botName) && !botName.equals(e.getBullet().getName())) { _out.println(warning() + WARNING_BULLET_HIT_BULLET_UNKNOWN + " (" + botName + ")"); } } GunDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); @Override void initRound(); void execute(int currentRound, long currentTime, double bulletPower,
      double currentGunHeat, Point2D.Double myLocation, boolean is1v1,
      boolean painting); GunEnemy newEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); GunEnemy updateEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); void onBulletHit(BulletHitEvent e, long currentTime); void onBulletHitBullet(BulletHitBulletEvent e, long currentTime); double getDamageGiven(); double getAverageEnergy(); void markFiringWaves(long currentTime, boolean is1v1); void fireNextTickWave(Point2D.Double myNextLocation,
      Point2D.Double targetLocation, String targetName, int currentRound,
      long currentTime, double bulletPower, double myEnergy, double gunHeat,
      double myHeading, double myVelocity, int enemiesAlive); void addListener(GunDataListener listener); int getEnemiesTotal(); int getDuelDataSize(); void drawVictory(long startTime);  }
@Test public void testOnBulletHitBullet() { GunDataManager gdm = newGunDataManager(); gdm.newEnemy(_shadowSre, _enemyLocation, 0, 1, true); BulletHitBulletEvent bulletHitBulletEvent = _eventHelper.newBulletHitBulletEvent("Diamond", 3.0, "Shadow", 3.0); gdm.onBulletHitBullet(bulletHitBulletEvent, 50); assertFalse(_out.toString().contains( GunDataManager.WARNING_BULLET_HIT_BULLET_UNKNOWN)); }
@Test public void testOnBulletHitBulletUnknownBot() { GunDataManager gdm = newGunDataManager(); assertTrue(gdm.getAllEnemyData().isEmpty()); BulletHitBulletEvent bulletHitBulletEvent = _eventHelper.newBulletHitBulletEvent("Diamond", 3.0, "Shadow", 3.0); gdm.onBulletHitBullet(bulletHitBulletEvent, 50); assertTrue(_out.toString().contains( GunDataManager.WARNING_BULLET_HIT_BULLET_UNKNOWN)); }