Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

extract method refactoring

  • Loading branch information...
commit c7c2c2bc33e106166b5044e29ded5d750cfd506e 1 parent f9db7a7
x14764 authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 all_in/src/test/java/shoe/AllIn.java
View
16 all_in/src/test/java/shoe/AllIn.java
@@ -29,7 +29,19 @@ public void startBroker() throws Exception {
@Test
public void smoke() throws Exception {
produce();
+ consume();
+ waitForConsumptionToComplete();
+ assertThat(messagesReceived, is(MESSAGES_TO_SEND + 1));
+ }
+
+ private void waitForConsumptionToComplete() throws InterruptedException {
+ while(!shutdown) {
+ Thread.sleep(10);
+ }
+ }
+
+ private void consume() throws JMSException {
ConnectionFactory factory = new ActiveMQConnectionFactory(BROKER_URL);
Connection connection = factory.createConnection();
connection.start();
@@ -37,10 +49,6 @@ public void smoke() throws Exception {
Destination destination = session.createQueue(QUEUE_NAME);
MessageConsumer consumer = session.createConsumer(destination);
consumer.setMessageListener(new SimpleConsumer());
- while(!shutdown) {
- Thread.sleep(10);
- }
- assertThat(messagesReceived, is(MESSAGES_TO_SEND + 1));
}
private void produce() throws JMSException {
Please sign in to comment.
Something went wrong with that request. Please try again.