@Test public void sendMessage() throws InterruptedException { sut.send(new SimpleMessage("test", "queue")); assertThat(sut.getStats().getPendingCount()).isEqualTo(1); executor.execute(sut); await().until(() -> sut.getStats().getPendingCount() == 0); verify(jmsTemplate).send(eq("queue"), any()); verify(storage).addMessage(argThat( message -> message.getQueue().equals("queue") && message.getText().equals("test"))); assertThat(sut.getStats().getPendingCount()).isEqualTo(0); }
private void sendMessage(SimpleMessage message) { jmsTemplate.send(message.getQueue(), new SimpleMessageTextCreator(message)); outgoingStorage.addMessage(SimpleMessage.of(message)); }
AsyncMessageSender implements Runnable { private void sendMessage(SimpleMessage message) { jmsTemplate.send(message.getQueue(), new SimpleMessageTextCreator(message)); outgoingStorage.addMessage(SimpleMessage.of(message)); } }
AsyncMessageSender implements Runnable { private void sendMessage(SimpleMessage message) { jmsTemplate.send(message.getQueue(), new SimpleMessageTextCreator(message)); outgoingStorage.addMessage(SimpleMessage.of(message)); }  }
AsyncMessageSender implements Runnable { private void sendMessage(SimpleMessage message) { jmsTemplate.send(message.getQueue(), new SimpleMessageTextCreator(message)); outgoingStorage.addMessage(SimpleMessage.of(message)); }  Stats getStats(); void send(SimpleMessage message); @Override void run(); }
AsyncMessageSender implements Runnable { private void sendMessage(SimpleMessage message) { jmsTemplate.send(message.getQueue(), new SimpleMessageTextCreator(message)); outgoingStorage.addMessage(SimpleMessage.of(message)); }  Stats getStats(); void send(SimpleMessage message); @Override void run();  }