killbill-aplcache

Details

diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
index 1d48692..33c4298 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
@@ -165,7 +165,7 @@ public class TestOverdueIntegration extends TestIntegrationBase {
     @Test(groups={"slow"}, enabled = true)
     public void testBasicOverdueState() throws Exception {
         clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0));
-        paymentPlugin.makeAllInvoicesFailWithException(true);
+        paymentPlugin.makeAllInvoicesFailWithError(true);
         
         // set next invoice to fail and create network 
         busHandler.pushExpectedEvents(NextEvent.CREATE, NextEvent.INVOICE);
@@ -214,7 +214,7 @@ public class TestOverdueIntegration extends TestIntegrationBase {
         // should now be in OD2 state once the update is processed
         checkODState("OD3");
         
-        paymentPlugin.makeAllInvoicesFailWithException(false);
+        paymentPlugin.makeAllInvoicesFailWithError(false);
         Collection<Invoice> invoices = invoiceApi.getUnpaidInvoicesByAccountId(account.getId(), clock.getUTCNow());
         List<String> invoiceIds = new ArrayList<String>();
         for (Invoice invoice : invoices) {
diff --git a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
index c7247ab..36863ff 100644
--- a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
+++ b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
@@ -42,7 +42,7 @@ public class MockPaymentProviderPlugin implements PaymentPluginApi {
     
     private final AtomicBoolean makeNextInvoiceFailWithError = new AtomicBoolean(false);
     private final AtomicBoolean makeNextInvoiceFailWithException = new AtomicBoolean(false);
-    private final AtomicBoolean makeAllInvoicesFailWithException = new AtomicBoolean(false);
+    private final AtomicBoolean makeAllInvoicesFailWithError = new AtomicBoolean(false);
     private final Map<UUID, PaymentInfoPlugin> payments = new ConcurrentHashMap<UUID, PaymentInfoPlugin>();
 
     private final Map<String, List<PaymentMethodPlugin>> paymentMethods = new ConcurrentHashMap<String, List<PaymentMethodPlugin>>();
@@ -59,7 +59,7 @@ public class MockPaymentProviderPlugin implements PaymentPluginApi {
     
     public void clear() {
         makeNextInvoiceFailWithException.set(false);
-        makeAllInvoicesFailWithException.set(false);
+        makeAllInvoicesFailWithError.set(false);
         makeNextInvoiceFailWithError.set(false);
     }
     
@@ -72,17 +72,17 @@ public class MockPaymentProviderPlugin implements PaymentPluginApi {
         makeNextInvoiceFailWithException.set(true);
     }
 
-    public void makeAllInvoicesFailWithException(boolean failure) {
-        makeAllInvoicesFailWithException.set(failure);
+    public void makeAllInvoicesFailWithError(boolean failure) {
+        makeAllInvoicesFailWithError.set(failure);
     }
 
     @Override
     public PaymentInfoPlugin processPayment(String externalKey, UUID paymentId, BigDecimal amount) throws PaymentPluginApiException {
-        if (makeNextInvoiceFailWithException.getAndSet(false) || makeAllInvoicesFailWithException.get()) {
+        if (makeNextInvoiceFailWithException.getAndSet(false)) {
             throw new PaymentPluginApiException("", "test error");
         }
 
-        PaymentPluginStatus status = makeNextInvoiceFailWithError.getAndSet(false) ? PaymentPluginStatus.ERROR : PaymentPluginStatus.PROCESSED;
+        PaymentPluginStatus status = (makeAllInvoicesFailWithError.get() || makeNextInvoiceFailWithError.getAndSet(false)) ? PaymentPluginStatus.ERROR : PaymentPluginStatus.PROCESSED;
         PaymentInfoPlugin result = new MockPaymentInfoPlugin(amount, clock.getUTCNow(), clock.getUTCNow(), status, null);
         payments.put(paymentId, result);
         return result;