### Question:
CompensableInterceptor implements EventAwareInterceptor { @Override public AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod, int forwardRetries, int forwardTimeout, int reverseRetries, int reverseTimeout, int retryDelayInMilliseconds, Object... message) { return sender.send(new TxStartedEvent(context.globalTxId(), context.localTxId(), parentTxId, compensationMethod, timeout, retriesMethod, forwardRetries, forwardTimeout, reverseRetries, reverseTimeout, retryDelayInMilliseconds, message)); } CompensableInterceptor(OmegaContext context, SagaMessageSender sender); @Override AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod,
      int forwardRetries, int forwardTimeout, int reverseRetries, int reverseTimeout, int retryDelayInMilliseconds, Object... message); @Override void postIntercept(String parentTxId, String compensationMethod); @Override void onError(String parentTxId, String compensationMethod, Throwable throwable);  }### Answer:
@Test public void sendsTxStartedEventBefore() throws Exception { int timeout = new Random().nextInt(); int forwardRetries = new Random().nextInt(); int forwardTimeout = new Random().nextInt(); int reverseRetries = new Random().nextInt(); int reverseTimeout = new Random().nextInt(); int retryDelayInMilliseconds = new Random().nextInt(); interceptor.preIntercept(parentTxId, compensationMethod, timeout, retryMethod, forwardRetries, forwardTimeout, reverseRetries, reverseTimeout, retryDelayInMilliseconds, message); TxEvent event = messages.get(0); assertThat(event.globalTxId(), is(globalTxId)); assertThat(event.localTxId(), is(localTxId)); assertThat(event.parentTxId(), is(parentTxId)); assertThat(event.forwardRetries(), is(forwardRetries)); assertThat(event.forwardTimeout(), is(forwardTimeout)); assertThat(event.reverseRetries(), is(reverseRetries)); assertThat(event.reverseTimeout(), is(reverseTimeout)); assertThat(event.timeout(), is(timeout)); assertThat(event.retryDelayInMilliseconds(), is(retryDelayInMilliseconds)); assertThat(event.retryMethod(), is(retryMethod)); assertThat(event.type(), is(EventType.TxStartedEvent)); assertThat(event.compensationMethod(), is(compensationMethod)); assertThat(asList(event.payloads()).contains(message), is(true)); }