### Question:
MessageInterceptor implements MethodInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { Message message = (Message) invocation.getArguments()[1]; MessageProperties messageProperties = message.getMessageProperties(); MessageContext messageContext = new MessageContext(messageProperties); idempotentMessageContextService.clear(); idempotentMessageContextService.set(messageContext); return invocation.proceed(); }  @Override Object invoke(MethodInvocation invocation);  }### Answer:
@Test void testInvoke() throws Throwable { MethodInvocation invocation = createMethodInvocation(); interceptor.invoke(invocation); verify(mIdempotentMessageContextService).clear(); ArgumentCaptor<MessageContext> idempotentContextArgumentCaptor = ArgumentCaptor.forClass(MessageContext.class); verify(mIdempotentMessageContextService).set(idempotentContextArgumentCaptor.capture()); MessageContext messageContext = idempotentContextArgumentCaptor.getValue(); assertThat(messageContext, notNullValue()); assertThat(messageContext.getMessageId(), equalTo(MESSAGE_ID)); assertThat(messageContext.getConsumerQueueName(), equalTo(CONSUMER_QUEUE)); assertThat(messageContext.getMessageDate(), equalTo(TIMESTAMP)); }