3 Replies Latest reply on Nov 4, 2009 9:06 AM by Clebert Suconic

    You cannot call assertEquals() from different threads

    Tim Fox Master

      I have just noticed that LargeMessageTestBase uses Junit assertEquals (or other asserts) inside a different thread to the thread that run the test, e.g.

      E.g. the message handler class

      MessageHandler handler = new MessageHandler()

      calls assertEquals() in several places.


      assertXXX in Junit MUST be called from the main thread that ran the test. If it is called from other threads it will not cause the test to fail.

      I just noticed that LargeMessageTest was passing but when I looked at the logs, several assertion failures were occurring.

      Don't do this. It is VERY bad practice.