Hi team, After looking into writing unit tests for a feature where I have to wait to see if the task hascompleted, I found a library called Awaitility ( https://github.com/awaitility/), that is very elegant and suitable for the purpose. The error-prone way of achieving the same is using Thread.sleep.
It has a very beautiful and intuitive API where you can write code that looks like English sentences. For example. await().atMost(5, SECONDS).until(() -> userRepository.size() == 1); Check the usage guide for more details: https://github.com/ awaitility/awaitility/wiki/Usage Please take a look and adopt this library where applicable. -- *Afkham Azeez* Senior Director, Platform Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>* *email: **az...@wso2.com* <az...@wso2.com> * cell: +94 77 3320919blog: **http://blog.afkham.org* <http://blog.afkham.org> *twitter: **http://twitter.com/afkham_azeez* <http://twitter.com/afkham_azeez> *linked-in: **http://lk.linkedin.com/in/afkhamazeez <http://lk.linkedin.com/in/afkhamazeez>* *Lean . Enterprise . Middleware*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev