LabelledEvents { public static <T> void start(T query, String correlationId, EventBus bus, String... labels) { for (String label : labels) { AddLabelledQuery<T> next = start(query, correlationId, label, null); bus.post(next); } }  static void start(T query, String correlationId, EventBus bus, String... labels); static AddLabelledQuery<T> start(T query, String correlationId, String label); static AddLabelledQuery<T> start(T query, String correlationId, String label, Object additionalData); static void finish(T query, String correlationId, EventBus bus, String... labels); static RemoveLabelledQuery<T> finish(T query, String correlationId, String label);  }
@Test public void createAddLabelledQuery() { AddLabelledQuery<String> userQuery = LabelledEvents.start(query, corrId, label); RequestData rd = userQuery.getData(); assertThat(rd.getQuery(), is(query)); assertThat(rd.getType(), is(label)); assertThat(rd.getCorrelationId(), is(corrId)); }
@Test public void createAddLabelledQueryWithAdditionalData() { AddLabelledQuery<String> userQuery = LabelledEvents.start(query, corrId, label, addData); RequestData rd = userQuery.getData(); assertThat(rd.getQuery(), is(query)); assertThat(rd.getType(), is(label)); assertThat(rd.getCorrelationId(), is(corrId)); assertThat(rd.getAdditionalData(), is(addData)); }