Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index




On 2015-06-01 09:33 AM, Miklos Vajna wrote:
On Sat, May 30, 2015 at 04:47:56PM +0200, Lionel Elie Mamane <lionel@mamane.lu> wrote:
I fixed the underlying bug, but I would like to fix the test so that
it fails when one of the threads fails. I tried to not catch the
Exception, but that does not help. (I noticed the thread failure by
looking at workdir/JunitTest/dbaccess_complex/done.log )

Can't you call org.junit.Assert.fail() in the catch block?


That's what the current code is doing, but org.junit.Assert.fail() just throws an AssertionError, so doing that inside a child thread is not useful.

The better way is to use ExecutorService, Callable, and Future.get(), see here for an example:

http://stackoverflow.com/questions/6546193/how-to-catch-an-exception-from-a-thread

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.