@Test public void shouldFilterPatternsByStation(){ HatSample hatSampleA = new HatSample(); hatSampleA.setId(1); hatSampleA.setStationId("1"); HatSample hatSampleB = new HatSample(); hatSampleB.setId(2); hatSampleB.setStationId("2"); SourceData sourceData = new SourceData(); sourceData.setHatSamples(Arrays.asList(hatSampleA, hatSampleB)); List<HatSample> filteredSamples = this.hatSampleOptions.getHatSampleOptions(2, sourceData); assertThat(filteredSamples).hasSize(1); AssertionsForClassTypes.assertThat(filteredSamples.get(0).getId()).isEqualTo(2); }
public List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData) { return sourceData.getHatSamples().stream().filter(hatSample -> hatSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }
HatSampleOptions { public List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData) { return sourceData.getHatSamples().stream().filter(hatSample -> hatSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); } }
HatSampleOptions { public List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData) { return sourceData.getHatSamples().stream().filter(hatSample -> hatSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  }
HatSampleOptions { public List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData) { return sourceData.getHatSamples().stream().filter(hatSample -> hatSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData); }
HatSampleOptions { public List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData) { return sourceData.getHatSamples().stream().filter(hatSample -> hatSample.getStationId().equalsIgnoreCase(Integer.toString(stationId))).collect(Collectors.toList()); }  List<HatSample> getHatSampleOptions(int stationId, SourceData sourceData);  }