killbill-aplcache

subscription: add missing listener status checks Signed-off-by:

11/14/2013 8:56:41 PM

Details

diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/migration/TestMigration.java b/subscription/src/test/java/com/ning/billing/subscription/api/migration/TestMigration.java
index 4512b71..1a4b0fe 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/migration/TestMigration.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/migration/TestMigration.java
@@ -56,7 +56,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
             assertEquals(bundles.size(), 1);
@@ -91,7 +91,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
             assertEquals(bundles.size(), 1);
@@ -139,7 +139,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
             assertEquals(bundles.size(), 1);
@@ -162,7 +162,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusYears(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             assertTrue(subscription.getStartDate().compareTo(startDate) == 0);
             assertNotNull(subscription.getEndDate());
@@ -185,7 +185,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
             assertEquals(bundles.size(), 1);
@@ -208,7 +208,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(30));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             assertEquals(subscription.getStartDate(), trialDate);
             assertEquals(subscription.getEndDate(), null);
@@ -233,7 +233,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
             assertEquals(bundles.size(), 1);
@@ -254,7 +254,7 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             //assertDateWithin(subscription.getStartDate(), beforeMigration, afterMigration);
             assertEquals(subscription.getEndDate(), null);
@@ -281,7 +281,6 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
             assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
@@ -304,7 +303,9 @@ public class TestMigration extends SubscriptionTestSuiteWithEmbeddedDB {
             assertEquals(billingTransitions.get(0), initialMigrateBilling);
 
             // Now make an IMMEDIATE change of plan
+            testListener.pushExpectedEvent(NextEvent.CHANGE);
             subscription.changePlanWithDate("Assault-Rifle", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, clock.getUTCNow(), callContext);
+            assertListenerStatus();
 
             final List<SubscriptionBaseTransition> newTransitions = subscription.getAllTransitions();
             assertEquals(newTransitions.size(), 3);
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairBP.java b/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairBP.java
index 2d7d120..54ce65a 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairBP.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairBP.java
@@ -180,7 +180,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         subscriptionRepair = realRunBundleRepair.getSubscriptions();
         assertEquals(subscriptionRepair.size(), 1);
@@ -241,7 +241,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.PHASE);
         final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(32));
         clock.addDeltaFromReality(it.toDurationMillis());
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         // CHECK WHAT"S GOING ON AFTER WE MOVE CLOCK-- FUTURE MOTIFICATION SHOULD KICK IN
         final DefaultSubscriptionBase subscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(baseSubscriptionId, internalCallContext);
@@ -297,7 +297,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(clockShift));
             clock.addDeltaFromReality(it.toDurationMillis());
             if (!inTrial) {
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
             }
         }
 
@@ -355,7 +355,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
         subscriptionRepair = realRunBundleRepair.getSubscriptions();
         assertEquals(subscriptionRepair.size(), 1);
         cur = subscriptionRepair.get(0);
@@ -413,7 +413,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.PHASE);
         final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(32));
         clock.addDeltaFromReality(it.toDurationMillis());
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
         final DefaultSubscriptionBase subscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(baseSubscriptionId, internalCallContext);
 
         assertEquals(subscription.getActiveVersion(), SubscriptionEvents.INITIAL_VERSION + 1);
@@ -468,7 +468,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(clockShift));
         clock.addDeltaFromReality(it.toDurationMillis());
         if (!inTrial) {
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
         }
 
         final BundleBaseTimeline bundleRepair = repairApi.getBundleTimeline(bundle.getId(), callContext);
@@ -526,7 +526,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         subscriptionRepair = realRunBundleRepair.getSubscriptions();
         assertEquals(subscriptionRepair.size(), 1);
@@ -574,7 +574,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
 
         final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(35));
         clock.addDeltaFromReality(it.toDurationMillis());
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         // SET CTD to BASE SUBSCRIPTION SP CANCEL OCCURS EOT
         final DateTime newChargedThroughDate = baseSubscription.getStartDate().plusDays(30).plusMonths(1);
@@ -608,7 +608,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
         final boolean dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         baseSubscription = subscriptionInternalApi.getSubscriptionFromId(baseSubscription.getId(), internalCallContext);
 
@@ -655,7 +655,7 @@ public class TestRepairBP extends SubscriptionTestSuiteWithEmbeddedDB {
                 testListener.pushExpectedEvent(NextEvent.CHANGE);
                 final DateTime changeTime = clock.getUTCNow();
                 baseSubscription.changePlanWithDate("Assault-Rifle", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, changeTime, callContext);
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 repairApi.repairBundle(bRepair, true, callContext);
                 assertListenerStatus();
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithAO.java b/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithAO.java
index 8ea1dcb..5e457b8 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithAO.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithAO.java
@@ -158,7 +158,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bundleRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         aoRepair = testUtil.getSubscriptionRepair(aoSubscription.getId(), realRunBundleRepair);
         assertEquals(aoRepair.getExistingEvents().size(), 2);
@@ -218,7 +218,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
 
         it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(32));
         clock.addDeltaFromReality(it.toDurationMillis());
-        assertTrue(testListener.isCompleted(7000));
+        assertListenerStatus();
 
         BundleBaseTimeline bundleRepair = repairApi.getBundleTimeline(bundle.getId(), callContext);
         testUtil.sortEventsOnBundle(bundleRepair);
@@ -287,7 +287,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bundleRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         aoRepair = testUtil.getSubscriptionRepair(aoSubscription.getId(), realRunBundleRepair);
         assertEquals(aoRepair.getExistingEvents().size(), 3);
@@ -337,7 +337,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
 
         it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(40));
         clock.addDeltaFromReality(it.toDurationMillis());
-        assertTrue(testListener.isCompleted(7000));
+        assertListenerStatus();
 
         // SET CTD to BASE SUBSCRIPTION SP CANCEL OCCURS EOT
         final DateTime newChargedThroughDate = baseSubscription.getStartDate().plusDays(30).plusMonths(1);
@@ -408,7 +408,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bundleRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         aoRepair = testUtil.getSubscriptionRepair(aoSubscription.getId(), realRunBundleRepair);
         assertEquals(aoRepair.getExistingEvents().size(), 3);
@@ -508,7 +508,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         aoRepair = testUtil.getSubscriptionRepair(aoSubscription.getId(), realRunBundleRepair);
         assertEquals(aoRepair.getExistingEvents().size(), 2);
@@ -594,7 +594,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         aoRepair = testUtil.getSubscriptionRepair(aoSubscription.getId(), realRunBundleRepair);
         assertEquals(aoRepair.getExistingEvents().size(), 2);
@@ -685,7 +685,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
         dryRun = false;
         testListener.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
         final BundleBaseTimeline realRunBundleRepair = repairApi.repairBundle(bRepair, dryRun, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         aoRepair = testUtil.getSubscriptionRepair(aoSubscription.getId(), realRunBundleRepair);
         assertEquals(aoRepair.getExistingEvents().size(), 3);
@@ -718,7 +718,7 @@ public class TestRepairWithAO extends SubscriptionTestSuiteWithEmbeddedDB {
 
         it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(60));
         clock.addDeltaFromReality(it.toDurationMillis());
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         newAoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
         currentPhase = newAoSubscription.getCurrentPhase();
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithError.java b/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithError.java
index d5f806f..7423bbe 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithError.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/timeline/TestRepairWithError.java
@@ -72,7 +72,7 @@ public class TestRepairWithError extends SubscriptionTestSuiteNoDB {
                 final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(40));
                 clock.addDeltaFromReality(it.toDurationMillis());
 
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 final BundleBaseTimeline bundleRepair = repairApi.getBundleTimeline(bundle.getId(), callContext);
                 testUtil.sortEventsOnBundle(bundleRepair);
@@ -100,13 +100,13 @@ public class TestRepairWithError extends SubscriptionTestSuiteNoDB {
                 testListener.pushExpectedEvent(NextEvent.CHANGE);
                 final DateTime changeTime = clock.getUTCNow();
                 baseSubscription.changePlanWithDate("Assault-Rifle", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, changeTime, callContext);
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 // MOVE AFTER TRIAL
                 testListener.pushExpectedEvent(NextEvent.PHASE);
                 it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(40));
                 clock.addDeltaFromReality(it.toDurationMillis());
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 final BundleBaseTimeline bundleRepair = repairApi.getBundleTimeline(bundle.getId(), callContext);
                 testUtil.sortEventsOnBundle(bundleRepair);
@@ -152,7 +152,7 @@ public class TestRepairWithError extends SubscriptionTestSuiteNoDB {
                 testListener.pushExpectedEvent(NextEvent.PHASE);
                 final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(40));
                 clock.addDeltaFromReality(it.toDurationMillis());
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 final BundleBaseTimeline bundleRepair = repairApi.getBundleTimeline(bundle.getId(), callContext);
                 testUtil.sortEventsOnBundle(bundleRepair);
@@ -181,7 +181,7 @@ public class TestRepairWithError extends SubscriptionTestSuiteNoDB {
                 testListener.pushExpectedEvent(NextEvent.PHASE);
                 final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(40));
                 clock.addDeltaFromReality(it.toDurationMillis());
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 final BundleBaseTimeline bundleRepair = repairApi.getBundleTimeline(bundle.getId(), callContext);
                 testUtil.sortEventsOnBundle(bundleRepair);
@@ -292,7 +292,7 @@ public class TestRepairWithError extends SubscriptionTestSuiteNoDB {
 
                 final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(4));
                 clock.addDeltaFromReality(it.toDurationMillis());
-                //assertTrue(testListener.isCompleted(5000));
+                //assertListenerStatus();
 
                 final DefaultSubscriptionBase aoSubscription = testUtil.createSubscription(bundle, "Laser-Scope", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME);
 
@@ -387,7 +387,7 @@ public class TestRepairWithError extends SubscriptionTestSuiteNoDB {
                 // MOVE CLOCK -- RIGHT OUT OF TRIAL
                 testListener.pushExpectedEvent(NextEvent.PHASE);                
                 clock.addDeltaFromReality(getDurationDay(5));
-                assertTrue(testListener.isCompleted(5000));
+                assertListenerStatus();
 
                 DateTime requestedChange = clock.getUTCNow();
                 baseSubscription.changePlanWithRequestedDate("Assault-Rifle", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, requestedChange, callcontext);
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/transfer/TestTransfer.java b/subscription/src/test/java/com/ning/billing/subscription/api/transfer/TestTransfer.java
index bf99755..6704bb1 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/transfer/TestTransfer.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/transfer/TestTransfer.java
@@ -64,7 +64,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
             migrationApi.migrate(toBeMigrated, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
             assertEquals(bundles.size(), 1);
@@ -97,7 +97,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.TRANSFER);
             testListener.pushExpectedEvent(NextEvent.CANCEL);
             transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, false, true, callContext);
-            assertTrue(testListener.isCompleted(3000));
+            assertListenerStatus();
 
             final SubscriptionBase oldBaseSubscription = subscriptionInternalApi.getBaseSubscription(bundle.getId(), internalCallContext);
             assertTrue(oldBaseSubscription.getState() == EntitlementState.CANCELLED);
@@ -139,7 +139,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         testListener.pushExpectedEvent(NextEvent.CANCEL);
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, false, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
         final DateTime afterTransferDate = clock.getUTCNow();
 
         // CHECK OLD BASE IS CANCEL AT THE TRANSFER DATE
@@ -192,7 +192,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         final DateTime transferRequestedDate = clock.getUTCNow();
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, false, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // CHECK OLD BASE IS CANCEL AT THE TRANSFER DATE
         final SubscriptionBase oldBaseSubscription = subscriptionInternalApi.getSubscriptionFromId(baseSubscription.getId(), internalCallContext);
@@ -236,14 +236,14 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         // MOVE AFTER TRIAL
         testListener.pushExpectedEvent(NextEvent.PHASE);
         clock.addDays(40);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         final DateTime beforeTransferDate = clock.getUTCNow();
         final DateTime transferRequestedDate = clock.getUTCNow();
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         testListener.pushExpectedEvent(NextEvent.CANCEL);
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, false, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
         final DateTime afterTransferDate = clock.getUTCNow();
 
         // CHECK OLD BASE IS CANCEL AT THE TRANSFER DATE
@@ -286,7 +286,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         // MOVE AFTER TRIAL
         testListener.pushExpectedEvent(NextEvent.PHASE);
         clock.addDays(40);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // SET CTD
         final DateTime ctd = baseSubscription.getStartDate().plusDays(30).plusMonths(1);
@@ -296,7 +296,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         final DateTime transferRequestedDate = clock.getUTCNow();
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, false, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // CHECK OLD BASE IS CANCEL AT THE TRANSFER DATE
         final SubscriptionBase oldBaseSubscription = subscriptionInternalApi.getSubscriptionFromId(baseSubscription.getId(), internalCallContext);
@@ -327,7 +327,9 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         final String newBaseProduct1 = "Assault-Rifle";
         final BillingPeriod newBaseTerm1 = BillingPeriod.ANNUAL;
         final DateTime changeDate1 = clock.getUTCNow();
+        testListener.pushExpectedEvent(NextEvent.CHANGE);
         newBaseSubscription.changePlan(newBaseProduct1, newBaseTerm1, basePriceList, callContext);
+        assertListenerStatus();
 
         newPlan = newBaseSubscription.getCurrentPlan();
         assertEquals(newPlan.getProduct().getName(), newBaseProduct1);
@@ -384,7 +386,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.PHASE);
         testListener.pushExpectedEvent(NextEvent.PHASE);
         clock.addDays(5);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // SET CTD TO TRIGGER CANCELLATION EOT
         final DateTime ctd = baseSubscription.getStartDate().plusDays(30).plusMonths(1);
@@ -395,7 +397,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, true, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // RETRIEVE NEW BUNDLE AND CHECK SUBSCRIPTIONS
         final List<SubscriptionBaseBundle> bundlesForAccountAndKey = subscriptionInternalApi.getBundlesForAccountAndKey(newAccountId, bundle.getExternalKey(), internalCallContext);
@@ -431,21 +433,22 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         assertTrue(foundAO2);
 
         // MOVE AFTER CANCEL DATE TO TRIGGER OLD SUBSCRIPTIONS CANCELLATION + LASER_SCOPE PHASE EVENT
-        testListener.pushExpectedEvent(NextEvent.PHASE);
+        testListener.pushExpectedEvents(NextEvent.PHASE, NextEvent.PHASE);
         testListener.pushExpectedEvent(NextEvent.CANCEL);
         testListener.pushExpectedEvent(NextEvent.CANCEL);
         testListener.pushExpectedEvent(NextEvent.CANCEL);
         clock.addMonths(1);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // ISSUE ANOTHER TRANSFER TO CHECK THAT WE CAN TRANSFER AGAIN-- NOTE WILL NOT WORK ON PREVIOUS ACCOUNT (LIMITATION)
         final UUID finalNewAccountId = UUID.randomUUID();
         final DateTime newTransferRequestedDate = clock.getUTCNow();
+        testListener.pushExpectedEvent(NextEvent.CANCEL);
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         transferApi.transferBundle(newBundle.getAccountId(), finalNewAccountId, newBundle.getExternalKey(), newTransferRequestedDate, true, false, callContext);
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
     }
 
@@ -472,7 +475,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         testListener.pushExpectedEvent(NextEvent.PHASE);
         testListener.pushExpectedEvent(NextEvent.PHASE);
         clock.addDays(30);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // SET CTD TO TRIGGER CANCELLATION EOT
         final DateTime ctd = baseSubscription.getStartDate().plusDays(30).plusMonths(1);
@@ -482,14 +485,16 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         subscriptionInternalApi.setChargedThroughDate(aoSubscription1.getId(), ctd, internalCallContext);
 
         // CANCEL ADDON
+        testListener.pushExpectedEvent(NextEvent.CANCEL);
         aoSubscription1.cancelWithDate(clock.getUTCNow(), callContext);
+        assertListenerStatus();
 
         clock.addDays(1);
 
         final DateTime transferRequestedDate = clock.getUTCNow();
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, true, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         final List<SubscriptionBaseBundle> bundlesForAccountAndKey = subscriptionInternalApi.getBundlesForAccountAndKey(newAccountId, bundle.getExternalKey(), internalCallContext);
         assertEquals(bundlesForAccountAndKey.size(), 1);
@@ -513,7 +518,7 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
 
         testListener.pushExpectedEvent(NextEvent.PHASE);
         clock.addDays(30);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // SET CTD TO TRIGGER CANCELLATION EOT
         final DateTime ctd = baseSubscription.getStartDate().plusDays(30).plusMonths(1);
@@ -528,14 +533,14 @@ public class TestTransfer extends SubscriptionTestSuiteWithEmbeddedDB {
         clock.addDays(1);
         testListener.pushExpectedEvent(NextEvent.UNCANCEL);
         baseSubscription.uncancel(callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         // MOVE CLOCK one day AHEAD AND UNCANCEL BP
         clock.addDays(1);
         final DateTime transferRequestedDate = clock.getUTCNow();
         testListener.pushExpectedEvent(NextEvent.TRANSFER);
         transferApi.transferBundle(bundle.getAccountId(), newAccountId, bundle.getExternalKey(), transferRequestedDate, true, false, callContext);
-        assertTrue(testListener.isCompleted(3000));
+        assertListenerStatus();
 
         final List<SubscriptionBaseBundle> bundlesForAccountAndKey = subscriptionInternalApi.getBundlesForAccountAndKey(newAccountId, bundle.getExternalKey(), internalCallContext);
         assertEquals(bundlesForAccountAndKey.size(), 1);
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestSubscriptionHelper.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestSubscriptionHelper.java
index 3779fed..27dc44e 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestSubscriptionHelper.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestSubscriptionHelper.java
@@ -35,6 +35,7 @@ import org.testng.Assert;
 import com.ning.billing.ErrorCode;
 import com.ning.billing.api.TestApiListener;
 import com.ning.billing.api.TestApiListener.NextEvent;
+import com.ning.billing.api.TestListenerStatus;
 import com.ning.billing.catalog.api.BillingPeriod;
 import com.ning.billing.catalog.api.Duration;
 import com.ning.billing.catalog.api.PhaseType;
@@ -43,6 +44,8 @@ import com.ning.billing.catalog.api.PriceListSet;
 import com.ning.billing.catalog.api.ProductCategory;
 import com.ning.billing.catalog.api.TimeUnit;
 import com.ning.billing.clock.Clock;
+import com.ning.billing.subscription.SubscriptionTestListenerStatus;
+import com.ning.billing.subscription.SubscriptionTestSuiteWithEmbeddedDB;
 import com.ning.billing.subscription.api.SubscriptionBaseTransitionType;
 import com.ning.billing.subscription.api.migration.SubscriptionBaseMigrationApi.AccountMigration;
 import com.ning.billing.subscription.api.migration.SubscriptionBaseMigrationApi.BundleMigration;
@@ -80,15 +83,18 @@ public class TestSubscriptionHelper {
 
     private final TestApiListener testListener;
 
+    private final TestListenerStatus testListenerStatus;
+
     private final SubscriptionDao dao;
 
 
     @Inject
-    public TestSubscriptionHelper(final SubscriptionBaseInternalApi subscriptionApi, final Clock clock, final InternalCallContext callContext, final TestApiListener testListener, final SubscriptionDao dao) {
+    public TestSubscriptionHelper(final SubscriptionBaseInternalApi subscriptionApi, final Clock clock, final InternalCallContext callContext, final TestApiListener testListener, final TestListenerStatus testListenerStatus, final SubscriptionDao dao) {
         this.subscriptionApi = subscriptionApi;
         this.clock = clock;
         this.callContext = callContext;
         this.testListener = testListener;
+        this.testListenerStatus = testListenerStatus;
         this.dao = dao;
     }
 
@@ -111,7 +117,9 @@ public class TestSubscriptionHelper {
                                                                                                    requestedDate == null ? clock.getUTCNow() : requestedDate, callContext);
         assertNotNull(subscription);
 
-        assertTrue(testListener.isCompleted(5000));
+        assertTrue(testListener.isCompleted(SubscriptionTestSuiteWithEmbeddedDB.DELAY));
+        ((SubscriptionTestListenerStatus) testListenerStatus).assertListenerStatus();
+
         return subscription;
     }
 
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiAddOn.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiAddOn.java
index 8fe554e..1b2d8af 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiAddOn.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiAddOn.java
@@ -68,7 +68,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             final DateTime now = clock.getUTCNow();
             aoSubscription.cancel(callContext);
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
             assertEquals(aoSubscription.getState(), EntitlementState.CANCELLED);
 
@@ -100,7 +100,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             testListener.pushExpectedEvent(NextEvent.PHASE);
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
 
             // SET CTD TO CANCEL IN FUTURE
@@ -141,7 +141,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
 
             testListener.pushExpectedEvent(NextEvent.UNCANCEL);
             aoSubscription.uncancel(callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
             aoTransitions =  aoSubscription.getAllTransitions();
@@ -183,7 +183,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             // MOVE CLOCK AFTER TRIAL + AO DISCOUNT
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(2));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD TO CANCEL IN FUTURE
             final DateTime now = clock.getUTCNow();
@@ -208,7 +208,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
 
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // REFETCH AO SUBSCRIPTION AND CHECK THIS IS CANCELLED
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
@@ -245,7 +245,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             // MOVE CLOCK AFTER TRIAL + AO DISCOUNT
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(2));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD TO CANCEL IN FUTURE
             final DateTime now = clock.getUTCNow();
@@ -268,7 +268,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.UNCANCEL);
             baseSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(baseSubscription.getId(), internalCallContext);
             baseSubscription.uncancel(callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
             assertEquals(aoSubscription.getState(), EntitlementState.ACTIVE);
@@ -320,7 +320,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             // MOVE CLOCK AFTER TRIAL + AO DISCOUNT
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(2));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD TO CHANGE IN FUTURE
             final DateTime now = clock.getUTCNow();
@@ -348,7 +348,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.CHANGE);
             testListener.pushExpectedEvent(NextEvent.CANCEL);
             baseSubscription.changePlan(newBaseProduct, newBaseTerm, newBasePriceList,  callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // REFETCH AO SUBSCRIPTION AND CHECK THIS CANCELLED
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
@@ -383,7 +383,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             // MOVE CLOCK AFTER TRIAL + AO DISCOUNT
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(2));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD TO CANCEL IN FUTURE
             final DateTime now = clock.getUTCNow();
@@ -420,7 +420,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.CANCEL);
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // REFETCH AO SUBSCRIPTION AND CHECK THIS CANCELLED
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
@@ -526,7 +526,7 @@ public class TestUserApiAddOn extends SubscriptionTestSuiteWithEmbeddedDB {
             // MOVE THROUGH TIME TO GO INTO EVERGREEN
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(33));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // CHECK EVERYTHING AGAIN
             aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext);
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCancel.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCancel.java
index 53468e3..cd1d5ed 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCancel.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCancel.java
@@ -107,7 +107,7 @@ public class TestUserApiCancel extends SubscriptionTestSuiteWithEmbeddedDB {
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             trialPhase = subscription.getCurrentPhase();
             assertEquals(trialPhase.getPhaseType(), PhaseType.EVERGREEN);
 
@@ -143,7 +143,7 @@ public class TestUserApiCancel extends SubscriptionTestSuiteWithEmbeddedDB {
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
             final DateTime future = clock.getUTCNow();
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             assertTrue(futureEndDate.compareTo(subscription.getEndDate()) == 0);
 
@@ -184,7 +184,7 @@ public class TestUserApiCancel extends SubscriptionTestSuiteWithEmbeddedDB {
 
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             trialPhase = subscription.getCurrentPhase();
             assertEquals(trialPhase.getPhaseType(), PhaseType.EVERGREEN);
 
@@ -192,7 +192,7 @@ public class TestUserApiCancel extends SubscriptionTestSuiteWithEmbeddedDB {
 
             // CANCEL
             subscription.cancel(callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final PlanPhase currentPhase = subscription.getCurrentPhase();
             assertNull(currentPhase);
@@ -227,7 +227,7 @@ public class TestUserApiCancel extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             PlanPhase currentPhase = subscription.getCurrentPhase();
             assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);
 
@@ -246,7 +246,7 @@ public class TestUserApiCancel extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.UNCANCEL);
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final Plan currentPlan = subscription.getCurrentPlan();
             assertEquals(currentPlan.getProduct().getName(), prod);
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiChangePlan.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiChangePlan.java
index d954388..9088ebc 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiChangePlan.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiChangePlan.java
@@ -79,12 +79,12 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             final DateTime futureNow = clock.getUTCNow();
             final DateTime nextExpectedPhaseChange = TestSubscriptionHelper.addDuration(subscription.getStartDate(), currentPhase.getDuration());
             assertTrue(futureNow.isAfter(nextExpectedPhaseChange));
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // CHANGE PLAN
             testListener.pushExpectedEvent(NextEvent.CHANGE);
             subscription.changePlan(toProd, toTerm, toPlanSet, callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // CHECK CHANGE PLAN
             currentPhase = subscription.getCurrentPhase();
@@ -114,7 +114,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             PlanPhase currentPhase = subscription.getCurrentPhase();
             assertEquals(currentPhase.getPhaseType(), PhaseType.DISCOUNT);
 
@@ -147,7 +147,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.CHANGE);
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             subscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(subscription.getId(), internalCallContext);
             currentPhase = subscription.getCurrentPhase();
@@ -179,7 +179,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             subscription.changePlan(toProd, toTerm, toPlanSet, callContext);
             checkChangePlan(subscription, toProd, ProductCategory.BASE, toTerm, PhaseType.TRIAL);
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final PlanPhase currentPhase = subscription.getCurrentPhase();
             final DateTime nextExpectedPhaseChange = TestSubscriptionHelper.addDuration(subscription.getStartDate(), currentPhase.getDuration());
@@ -192,7 +192,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             final DateTime futureNow = clock.getUTCNow();
 
             assertTrue(futureNow.isAfter(nextExpectedPhaseChange));
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             assertListenerStatus();
         } catch (SubscriptionBaseApiException e) {
@@ -221,7 +221,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
             currentTime = clock.getUTCNow();
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD
             final Duration ctd = testUtil.getDurationMonth(1);
@@ -251,7 +251,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
             currentTime = clock.getUTCNow();
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // CHECK CORRECT PRODUCT, PHASE, PLAN SET
             final String currentProduct = subscription.getCurrentPlan().getProduct().getName();
@@ -279,7 +279,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             clock.addDeltaFromReality(it.toDurationMillis());
 
             currentTime = clock.getUTCNow();
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             assertListenerStatus();
         } catch (SubscriptionBaseApiException e) {
@@ -299,7 +299,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD
             final List<Duration> durationList = new ArrayList<Duration>();
@@ -321,7 +321,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             // CHANGE
             testListener.pushExpectedEvent(NextEvent.CHANGE);
             subscription.changePlan("Assault-Rifle", BillingPeriod.ANNUAL, "gunclubDiscount", callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final Plan currentPlan = subscription.getCurrentPlan();
             assertNotNull(currentPlan);
@@ -349,7 +349,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD
             final List<Duration> durationList = new ArrayList<Duration>();
@@ -390,7 +390,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1));
             clock.addDeltaFromReality(it.toDurationMillis());
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             currentPlan = subscription.getCurrentPlan();
             assertNotNull(currentPlan);
@@ -406,7 +406,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(6));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             subscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(subscription.getId(), internalCallContext);
 
             currentPlan = subscription.getCurrentPlan();
@@ -441,7 +441,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.reset();
             testListener.pushExpectedEvent(NextEvent.CHANGE);
             subscription.changePlan("Assault-Rifle", BillingPeriod.ANNUAL, "gunclubDiscount", callContext);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             testListener.reset();
 
             // CHECK EVERYTHING LOOKS CORRECT
@@ -459,7 +459,7 @@ public class TestUserApiChangePlan extends SubscriptionTestSuiteWithEmbeddedDB {
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(30));
             clock.addDeltaFromReality(it.toDurationMillis());
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             trialPhase = subscription.getCurrentPhase();
             assertEquals(trialPhase.getPhaseType(), PhaseType.DISCOUNT);
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCreate.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCreate.java
index c2b5dc8..b9279a3 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCreate.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiCreate.java
@@ -58,8 +58,10 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
             final String planSetName = PriceListSet.DEFAULT_PRICELIST_NAME;
 
 
+            testListener.pushExpectedEvents(NextEvent.CREATE, NextEvent.PHASE);
             final DefaultSubscriptionBase subscription = (DefaultSubscriptionBase) subscriptionInternalApi.createSubscription(bundle.getId(),
                                                                                                                               testUtil.getProductSpecifier(productName, planSetName, term, null), requestedDate, internalCallContext);
+            assertListenerStatus();
             assertNotNull(subscription);
 
             try {
@@ -70,14 +72,18 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
                 Assert.assertEquals(e.getCode(), ErrorCode.SUB_CREATE_ACTIVE_BUNDLE_KEY_EXISTS.getCode());
             }
 
+            testListener.pushExpectedEvent(NextEvent.CANCEL);
             subscription.cancelWithDate(clock.getUTCNow(), callContext);
+            assertListenerStatus();
 
             final SubscriptionBaseBundle newBundle = subscriptionInternalApi.createBundleForAccount(bundle.getAccountId(), DefaultSubscriptionTestInitializer.DEFAULT_BUNDLE_KEY, internalCallContext);
             assertNotNull(newBundle);
             assertEquals(newBundle.getOriginalCreatedDate().compareTo(bundle.getCreatedDate()), 0);
 
+            testListener.pushExpectedEvents(NextEvent.CREATE, NextEvent.PHASE);
             final DefaultSubscriptionBase newSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.createSubscription(newBundle.getId(),
                                                                                                                                  testUtil.getProductSpecifier(productName, planSetName, term, null), requestedDate, internalCallContext);
+            assertListenerStatus();
             assertNotNull(newSubscription);
 
 
@@ -120,7 +126,6 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
             assertEquals(subscription.getBundleId(), bundle.getId());
             assertEquals(subscription.getStartDate(), requestedDate);
 
-            assertTrue(testListener.isCompleted(5000));
             assertListenerStatus();
 
             final SubscriptionBaseTransition transition = subscription.getPreviousTransition();
@@ -206,7 +211,7 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
             final PlanPhase currentPhase = subscription.getCurrentPhase();
             assertNotNull(currentPhase);
             assertEquals(currentPhase.getPhaseType(), PhaseType.TRIAL);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             final List<SubscriptionBaseEvent> events = dao.getPendingEventsForSubscription(subscription.getId(), internalCallContext);
             assertNotNull(events);
@@ -224,7 +229,7 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
             final DateTime futureNow = clock.getUTCNow();
             assertTrue(futureNow.isAfter(nextPhaseChange));
 
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             assertListenerStatus();
         } catch (SubscriptionBaseApiException e) {
@@ -249,13 +254,13 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
             PlanPhase currentPhase = subscription.getCurrentPhase();
             assertNotNull(currentPhase);
             assertEquals(currentPhase.getPhaseType(), PhaseType.TRIAL);
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // MOVE TO DISCOUNT PHASE
             testListener.pushExpectedEvent(NextEvent.PHASE);
             Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
             currentPhase = subscription.getCurrentPhase();
             assertNotNull(currentPhase);
             assertEquals(currentPhase.getPhaseType(), PhaseType.DISCOUNT);
@@ -264,7 +269,7 @@ public class TestUserApiCreate extends SubscriptionTestSuiteWithEmbeddedDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusYears(1));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             subscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(subscription.getId(), internalCallContext);
             currentPhase = subscription.getCurrentPhase();
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiError.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiError.java
index bd50241..5bd00ee 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiError.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiError.java
@@ -175,7 +175,7 @@ public class TestUserApiError extends SubscriptionTestSuiteNoDB {
             testListener.pushExpectedEvent(NextEvent.PHASE);
             final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
             clock.addDeltaFromReality(it.toDurationMillis());
-            assertTrue(testListener.isCompleted(5000));
+            assertListenerStatus();
 
             // SET CTD TO CANCEL IN FUTURE
             final DateTime expectedPhaseTrialChange = TestSubscriptionHelper.addDuration(subscription.getStartDate(), trialPhase.getDuration());
diff --git a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiRecreate.java b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiRecreate.java
index c6a4242..e217d91 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiRecreate.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/api/user/TestUserApiRecreate.java
@@ -75,7 +75,7 @@ public abstract class TestUserApiRecreate extends SubscriptionTestSuiteWithEmbed
         assertEquals(subscription.getStartDate(), requestedDate);
         assertEquals(productName, subscription.getCurrentPlan().getProduct().getName());
 
-        assertTrue(testListener.isCompleted(5000));
+        assertListenerStatus();
 
         // CREATE (AGAIN) WITH NEW PRODUCT
         productName = "Pistol";
diff --git a/subscription/src/test/java/com/ning/billing/subscription/SubscriptionTestSuiteWithEmbeddedDB.java b/subscription/src/test/java/com/ning/billing/subscription/SubscriptionTestSuiteWithEmbeddedDB.java
index 53d397e..e6da5ea 100644
--- a/subscription/src/test/java/com/ning/billing/subscription/SubscriptionTestSuiteWithEmbeddedDB.java
+++ b/subscription/src/test/java/com/ning/billing/subscription/SubscriptionTestSuiteWithEmbeddedDB.java
@@ -34,6 +34,7 @@ import com.ning.billing.api.TestListenerStatus;
 import com.ning.billing.catalog.api.Catalog;
 import com.ning.billing.catalog.api.CatalogService;
 import com.ning.billing.clock.ClockMock;
+import com.ning.billing.subscription.api.SubscriptionBaseInternalApi;
 import com.ning.billing.subscription.api.SubscriptionBaseService;
 import com.ning.billing.subscription.api.migration.SubscriptionBaseMigrationApi;
 import com.ning.billing.subscription.api.timeline.SubscriptionBaseTimelineApi;
@@ -43,17 +44,20 @@ import com.ning.billing.subscription.api.user.TestSubscriptionHelper;
 import com.ning.billing.subscription.engine.dao.SubscriptionDao;
 import com.ning.billing.subscription.glue.TestDefaultSubscriptionModuleWithEmbeddedDB;
 import com.ning.billing.util.config.SubscriptionConfig;
-import com.ning.billing.subscription.api.SubscriptionBaseInternalApi;
 import com.ning.billing.util.svcsapi.bus.BusService;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Stage;
 
+import static org.testng.Assert.assertTrue;
+
 public class SubscriptionTestSuiteWithEmbeddedDB extends GuicyKillbillTestSuiteWithEmbeddedDB {
 
     protected static final Logger log = LoggerFactory.getLogger(SubscriptionTestSuiteWithEmbeddedDB.class);
 
+    public static final Long DELAY = 10000L;
+
     @Inject
     protected SubscriptionBaseService subscriptionBaseService;
     @Inject
@@ -114,14 +118,21 @@ public class SubscriptionTestSuiteWithEmbeddedDB extends GuicyKillbillTestSuiteW
         this.catalog = subscriptionTestInitializer.initCatalog(catalogService);
         this.accountData = subscriptionTestInitializer.initAccountData();
         this.bundle = subscriptionTestInitializer.initBundle(subscriptionInternalApi, internalCallContext);
+
+        // Make sure we start with a clean state
+        assertListenerStatus();
     }
 
     @AfterMethod(groups = "slow")
     public void afterMethod() throws Exception {
+        // Make sure we finish in a clean state
+        assertListenerStatus();
+
         subscriptionTestInitializer.stopTestFramework(testListener, busService, subscriptionBaseService);
     }
 
     protected void assertListenerStatus() {
+        assertTrue(testListener.isCompleted(DELAY));
         ((SubscriptionTestListenerStatus) testListenerStatus).assertListenerStatus();
     }
 }