FlightToTripNotificationsSplitter { @Splitter public List<TripNotification> generateTripNotificationsFrom(FlightNotification flightNotification, @Header("affectedTrips") List<Trip> affectedTrips) { List<TripNotification> notifications = new ArrayList<TripNotification>(affectedTrips.size()); for (Trip trip : affectedTrips) { notifications.add(new TripNotification(trip, flightNotification.getMessage())); } return notifications; }  @Splitter List<TripNotification> generateTripNotificationsFrom(FlightNotification flightNotification,
        @Header("affectedTrips") List<Trip> affectedTrips);  }
@Test public void shouldReturnTripNotificationForEachAffectedTrip() { FlightNotification flightNotification = new FlightNotification("Flight is cancelled", mock(Flight.class)); List<Trip> affectedTrips = new ArrayList<Trip>(5); affectedTrips.add(new Trip(Collections.singletonList(mock(Leg.class)))); List<TripNotification> notifications = splitter.generateTripNotificationsFrom(flightNotification, affectedTrips); for (TripNotification notification : notifications) { assertThat(affectedTrips, hasItem(notification.getTrip())); } }