@Test public void shouldSetHighestRated() { queueState = hitSelector.selectHits(queueState); Hit progressionUnitOneHit = queueState.getStructure().get(0).getProgressionUnitBars().get(0).getHit(); Hit progressionUnitTwoHit = queueState.getStructure().get(1).getProgressionUnitBars().get(0).getHit(); assertThat(progressionUnitOneHit).isNotNull(); assertThat(progressionUnitOneHit.getId()).isEqualTo(1); assertThat(progressionUnitTwoHit).isNotNull(); assertThat(progressionUnitTwoHit.getId()).isEqualTo(1); }
@Override public QueueState selectHits(QueueState queueState) { Hit selectedHit = queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ progressionUnitBar.setHit(selectedHit); } } return queueState; }
HitSelector implements IHitSelector { @Override public QueueState selectHits(QueueState queueState) { Hit selectedHit = queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ progressionUnitBar.setHit(selectedHit); } } return queueState; } }
HitSelector implements IHitSelector { @Override public QueueState selectHits(QueueState queueState) { Hit selectedHit = queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ progressionUnitBar.setHit(selectedHit); } } return queueState; }  }
HitSelector implements IHitSelector { @Override public QueueState selectHits(QueueState queueState) { Hit selectedHit = queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ progressionUnitBar.setHit(selectedHit); } } return queueState; }  @Override QueueState selectHits(QueueState queueState); }
HitSelector implements IHitSelector { @Override public QueueState selectHits(QueueState queueState) { Hit selectedHit = queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getHits(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ progressionUnitBar.setHit(selectedHit); } } return queueState; }  @Override QueueState selectHits(QueueState queueState);  }