@Test public void shouldFilterPatternsByStation(){ SnareSample snareSampleA = new SnareSample(); snareSampleA.setId(1); snareSampleA.setStationId("1"); SnareSample snareSampleB = new SnareSample(); snareSampleB.setId(2); snareSampleB.setStationId("2"); SourceData sourceData = new SourceData(); sourceData.setSnareSamples(Arrays.asList(snareSampleA, snareSampleB)); List<SnareSample> filteredSamples = this.snareSampleOptions.getSnareSampleOptions(2, sourceData); assertThat(filteredSamples).hasSize(1); AssertionsForClassTypes.assertThat(filteredSamples.get(0).getId()).isEqualTo(2); }
public List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData) { return sourceData.getSnareSamples().stream().filter(snareSample -> snareSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }
SnareSampleOptions { public List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData) { return sourceData.getSnareSamples().stream().filter(snareSample -> snareSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); } }
SnareSampleOptions { public List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData) { return sourceData.getSnareSamples().stream().filter(snareSample -> snareSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  }
SnareSampleOptions { public List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData) { return sourceData.getSnareSamples().stream().filter(snareSample -> snareSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData); }
SnareSampleOptions { public List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData) { return sourceData.getSnareSamples().stream().filter(snareSample -> snareSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  List<SnareSample> getSnareSampleOptions(int stationId, SourceData sourceData);  }