0 Replies Latest reply on Apr 20, 2010 8:27 PM by trappa

    Integration test for OptimisticLockException

    trappa

      I am writing an integration test to verify if OptimisticLockException is well handled.


      In pages.xml I added


      <exception class="javax.persistence.OptimisticLockException">
          <end-conversation/>
          <redirect view-id="/error.xhtml">
              <message severity="warn">Another user changed the same data, please try again</message>
          </redirect>
      </exception>



      In the console I can see that this exception is thrown, so the test is well writen. But I don't know what to do to verify that the user is redirected to error.xhtml.


      Moreover, even though I added before the test


      @Test(expectedExceptions=OptimisticLockException.class)



      the test fails.