From f21f99c44d49e33a7ca1b691a449bf8687503017 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Thu, 20 May 2010 15:20:21 +0000 Subject: Improved the asserts so we can see from the message what the failure condition was git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@946670 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/test/unit/ack/RecoverTest.java | 18 +++++------------- .../qpid/test/unit/topic/DurableSubscriptionTest.java | 9 +++++---- 2 files changed, 10 insertions(+), 17 deletions(-) (limited to 'qpid/java') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java index 50cb1ae9d7..666b914c09 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java @@ -240,8 +240,7 @@ public class RecoverTest extends FailoverBaseCase { if (message.getJMSRedelivered()) { - setError( - new Exception("Message marked as redilvered on what should be first delivery attempt")); + setError(new Exception("Message marked as redelivered on what should be first delivery attempt")); } consumerSession.recover(); @@ -251,8 +250,7 @@ public class RecoverTest extends FailoverBaseCase if (!message.getJMSRedelivered()) { setError( - new Exception( - "Message not marked as redilvered on what should be second delivery attempt")); + new Exception("Message not marked as redelivered on what should be second delivery attempt")); } } else @@ -293,19 +291,13 @@ public class RecoverTest extends FailoverBaseCase Thread.sleep(1000); - if (count.get() != 2) - { - System.err.println("Count != 2 : " + count); - } - - assertTrue(count.get() == 2); - - con.close(); - if (_error != null) { throw _error; } + + assertEquals("Message not received the correct number of times.", + 2, count.get()); } private void setError(Exception e) diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java index 5ead443ef1..800ea4e509 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java @@ -545,16 +545,17 @@ public class DurableSubscriptionTest extends QpidTestCase TopicSubscriber subB = session.createDurableSubscriber(topic, "testResubscribeWithChangedSelector","Match = False", false); - // Check messages are recieved properly + // Check messages are received properly sendMatchingAndNonMatchingMessage(session, producer); - rMsg = subB.receive(NEGATIVE_RECEIVE_TIMEOUT); - assertNotNull(rMsg); + rMsg = subB.receive(POSITIVE_RECEIVE_TIMEOUT); + + assertNotNull("Message should not be received", rMsg); assertEquals("Content was wrong", "testResubscribeWithChangedSelector2", ((TextMessage) rMsg).getText()); rMsg = subB.receive(NEGATIVE_RECEIVE_TIMEOUT); - assertNull(rMsg); + assertNull("Message should be received",rMsg); session.unsubscribe("testResubscribeWithChangedSelector"); } -- cgit v1.2.1