logo

JUnit expected exceptions, timeout and ignoring tests

JUnit expected exceptions, timeout and ignoring tests using @Ignore.

Sometimes you want to test that some method returns expected exception. You can easily do that by specifying attribute "expected" on annotation @Test.

You can also test that a unit test must take less than X milliseconds to execute, by specifying attribute "timeout" on annotation @Test

Sometimes you want to ignore some test (for example you have an unfinished test and your boss tells you to test something else). For such situations is annotation @Ignore


comments powered by Disqus

rss

Free online Java web application examples

Want to develop whole web applications which use database, security and more? See my github account, where are lot's of example projects:
github

Search