Trackers { public SendingTracker get(Subscription subscription) { switch (subscription.getTrackingMode()) { case TRACK_ALL: return sendingMessageTracker; case TRACK_DISCARDED_ONLY: return discardedSendingTracker; case TRACKING_OFF: return noOperationDeliveryTracker; } return noOperationDeliveryTracker; } Trackers(List<LogRepository> repositories);   Trackers(SendingMessageTracker sendingMessageTracker,
             DiscardedSendingTracker discardedSendingTracker,
             NoOperationSendingTracker noOperationDeliveryTracker); SendingTracker get(Subscription subscription); void add(LogRepository logRepository);  }
@Test public void shouldDispatchCorrectTracker() { assertThat(trackers.get(subscription("group.topic", "sub").withTrackingMode(TrackingMode.TRACKING_OFF) .build())).isEqualTo(noOperationDeliveryTracker); assertThat(trackers.get(subscription("group.topic", "sub") .withTrackingMode(TrackingMode.TRACK_DISCARDED_ONLY).build())).isEqualTo(discardedSendingTracker); assertThat(trackers.get(subscription("group.topic", "sub").withTrackingMode(TrackingMode.TRACK_ALL) .build())).isEqualTo(messageDeliveryTracker); }