### Question:
StationComponentsHolder { public Map<ComponentVariable, List<SetMonitoringDatum>> getByComponentAndVariable(List<ComponentVariable> componentVariables) { Map<ComponentVariable, List<SetMonitoringDatum>> result = new HashMap<>(); for (Map<ComponentVariable, List<SetMonitoringDatum>> map : getAllMaps()) { map.forEach((key, value) -> { if (componentVariables.contains(key)) { result.merge(key, value, (first, second) -> { List<SetMonitoringDatum> list = new ArrayList<>(first); list.addAll(second); return list; }); } } ); } return result; } StationComponentsHolder(Station station, StationStore stationStore); Optional<StationComponent> getComponent(CiString.CiString50 componentName); void monitorComponent(int monitorId, ComponentVariable componentVariable, SetMonitoringDatum datum); Map<ComponentVariable, List<SetMonitoringDatum>> getAllMonitoredComponents(); Map<ComponentVariable, List<SetMonitoringDatum>> getByComponentAndVariable(List<ComponentVariable> componentVariables); boolean clearMonitor(int id); List<ReportDatum> generateReportData(boolean onlyMutableVariables);  }### Answer:
@Test void testGetByComponentAndVariable() { final int size = 5; ComponentVariable cv = getComponentVariable("component", "variable"); ComponentVariable cv2 = getComponentVariable("component2", "variable2"); for (int i = 0; i < size; i++) { victim.monitorComponent(1, cv, generateDatum(1, SetMonitoringDatum.Type.DELTA, cv.getComponent(), cv.getVariable())); victim.monitorComponent(2, cv2, generateDatum(2, SetMonitoringDatum.Type.DELTA, cv2.getComponent(), cv2.getVariable())); victim.monitorComponent(2, cv, generateDatum(3, SetMonitoringDatum.Type.PERIODIC, cv.getComponent(), cv.getVariable())); } Map<ComponentVariable, List<SetMonitoringDatum>> result = victim.getByComponentAndVariable(Collections.singletonList(cv)); assertThat(result).hasSize(1); assertThat(result.get(cv)).hasSize(2 * size); result = victim.getByComponentAndVariable(Arrays.asList(cv, cv2)); assertThat(result).hasSize(2); assertThat(result.get(cv)).hasSize(2 * size); assertThat(result.get(cv2)).hasSize(size); }