Results 1 to 3 of 3

Thread: throwing exceptions from test methods

  1. #1

    Default throwing exceptions from test methods

    Hi,

    I have been trying to use ExpectedException and Test(expected=NullPointerException.class) annotations, in order to indicate to my JUnit test to expect an exception to be thrown from a test function. Prior to deriving from AbstractTransactionalDataSourceSpringContextTests, my test worked fine, but since i started deriving from this class, my test fails. I have checked and my function still throws the excepction, but it is not regarded as expected.

    is the use of ExpectedException annotation not supported with AbstractTransactionalDataSourceSpringContextTests?

    thank you,
    shahar.

  2. #2
    Join Date
    Oct 2007
    Location
    Toronto, ON
    Posts
    90

    Default

    Shahar,

    is your question related in any way to the Spring Integration project? If not (which I suspect), please address it to the appropriate section. In your case, I think it's the Core Container.

    Marius

    PS: In short, AbstractTransactionalDataSourceSpringContextTests is JUnit 3 based, while you are trying to use it in a JUnit 4 test, that's why it doesn't work. If you want more details, please address the question in the Core Container section.
    Marius Bogoevici,
    Spring Integration Committer

  3. #3

    Default

    Done.
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •