@Test public void shouldFilterPatternsByStation(){ KickSample kickSampleA = new KickSample(); kickSampleA.setId(1); kickSampleA.setStationId("1"); KickSample kickSampleB = new KickSample(); kickSampleB.setId(2); kickSampleB.setStationId("2"); SourceData sourceData = new SourceData(); sourceData.setKickSamples(Arrays.asList(kickSampleA, kickSampleB)); List<KickSample> filteredSamples = this.kickSampleOptions.getKickSampleOptions(2, sourceData); assertThat(filteredSamples).hasSize(1); assertThat(filteredSamples.get(0).getId()).isEqualTo(2); }
public List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData) { return sourceData.getKickSamples().stream().filter(kickSample -> kickSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }
KickSampleOptions { public List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData) { return sourceData.getKickSamples().stream().filter(kickSample -> kickSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); } }
KickSampleOptions { public List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData) { return sourceData.getKickSamples().stream().filter(kickSample -> kickSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  }
KickSampleOptions { public List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData) { return sourceData.getKickSamples().stream().filter(kickSample -> kickSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData); }
KickSampleOptions { public List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData) { return sourceData.getKickSamples().stream().filter(kickSample -> kickSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  List<KickSample> getKickSampleOptions(int stationId, SourceData sourceData);  }