@Test public void shouldSelectOneFill() { fillSelector.selectFills(queueState); for (ProgressionUnit pUnit : queueState.getStructure()) { assertThat(pUnit.getProgressionUnitBars().get(0).getFill()).isNull(); assertThat(pUnit.getProgressionUnitBars().get(2).getFill()).isNotNull(); } }
@Override public QueueState selectFills(QueueState queueState) { Fill selectedFill = queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ if(!progressionUnitBar.getFillOptions().isEmpty()){ progressionUnitBar.setFill(selectedFill); } } } return queueState; }
FillSelector implements IFillSelector { @Override public QueueState selectFills(QueueState queueState) { Fill selectedFill = queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ if(!progressionUnitBar.getFillOptions().isEmpty()){ progressionUnitBar.setFill(selectedFill); } } } return queueState; } }
FillSelector implements IFillSelector { @Override public QueueState selectFills(QueueState queueState) { Fill selectedFill = queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ if(!progressionUnitBar.getFillOptions().isEmpty()){ progressionUnitBar.setFill(selectedFill); } } } return queueState; }  }
FillSelector implements IFillSelector { @Override public QueueState selectFills(QueueState queueState) { Fill selectedFill = queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ if(!progressionUnitBar.getFillOptions().isEmpty()){ progressionUnitBar.setFill(selectedFill); } } } return queueState; }  @Override QueueState selectFills(QueueState queueState); }
FillSelector implements IFillSelector { @Override public QueueState selectFills(QueueState queueState) { Fill selectedFill = queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).get(new Random().nextInt(queueState.getDataSource().getFills(queueState.getQueueItem().getStationId()).size())); for(ProgressionUnit progressionUnit:queueState.getStructure()){ for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ if(!progressionUnitBar.getFillOptions().isEmpty()){ progressionUnitBar.setFill(selectedFill); } } } return queueState; }  @Override QueueState selectFills(QueueState queueState);  }