This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-customer.git

commit 2159f03d3c36e00f8af5512d778500f60ae9d019
Author: Mark <mark.vanv...@gmail.com>
AuthorDate: Fri Sep 15 15:27:36 2017 +0200

    Fix race conditions in task test
    - reset predefined tasks to false after test
    - reset events in recorder to prevent successful assert based on previous 
events
---
 .../src/main/java/io/mifos/customer/TestTaskInstance.java     | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git 
a/component-test/src/main/java/io/mifos/customer/TestTaskInstance.java 
b/component-test/src/main/java/io/mifos/customer/TestTaskInstance.java
index 7ff792c..edce92c 100644
--- a/component-test/src/main/java/io/mifos/customer/TestTaskInstance.java
+++ b/component-test/src/main/java/io/mifos/customer/TestTaskInstance.java
@@ -164,6 +164,8 @@ public class TestTaskInstance extends AbstractCustomerTest {
     
this.customerManager.taskForCustomerExecuted(randomCustomer.getIdentifier(), 
customTask2.getIdentifier());
     this.eventRecorder.wait(CustomerEventConstants.PUT_CUSTOMER, 
randomCustomer.getIdentifier());
 
+    this.eventRecorder.clear();
+
     final Command activateCustomer = new Command();
     activateCustomer.setAction(Command.Action.ACTIVATE.name());
     this.customerManager.customerCommand(randomCustomer.getIdentifier(), 
activateCustomer);
@@ -188,5 +190,14 @@ public class TestTaskInstance extends AbstractCustomerTest 
{
 
     final Customer customer = 
this.customerManager.findCustomer(randomCustomer.getIdentifier());
     Assert.assertEquals(Customer.State.ACTIVE.name(), 
customer.getCurrentState());
+
+    // set predefined to false so it does not have a side effect on other tests
+    customTask1.setPredefined(false);
+    this.customerManager.updateTask(customTask1.getIdentifier(), customTask1);
+    this.eventRecorder.wait(CustomerEventConstants.PUT_TASK, 
customTask1.getIdentifier());
+
+    customTask2.setPredefined(false);
+    this.customerManager.updateTask(customTask2.getIdentifier(), customTask1);
+    this.eventRecorder.wait(CustomerEventConstants.PUT_TASK, 
customTask2.getIdentifier());
   }
 }

-- 
To stop receiving notification emails like this one, please contact
my...@apache.org.

Reply via email to