Add exception for timeout - easier to read failure in test

This commit is contained in:
Dave Syer
2010-09-14 08:01:14 +01:00
parent 6233647a54
commit df9e8aafc2
2 changed files with 3 additions and 3 deletions

View File

@@ -26,7 +26,6 @@ import org.springframework.integration.support.MessageBuilder;
import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource;
/** /**

View File

@@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.MessageChannel; import org.springframework.integration.MessageChannel;
import org.springframework.integration.message.GenericMessage; import org.springframework.integration.message.GenericMessage;
@@ -97,7 +96,9 @@ public class JdbcMessageStoreChannelTests {
latch = new CountDownLatch(count); latch = new CountDownLatch(count);
} }
public static void await(long timeout) throws InterruptedException { public static void await(long timeout) throws InterruptedException {
latch.await(timeout, TimeUnit.MILLISECONDS); if (!latch.await(timeout, TimeUnit.MILLISECONDS)) {
throw new IllegalStateException("Timed out waiting for message");
}
} }
public String echo(String input) { public String echo(String input) {
messages.add(input); messages.add(input);