-
Mar 12th, 2010, 06:40 PM
#1
JUnit @Test(expected..) not working
Hi,
I'm using JUnit 4.7 and Spring 3.0.1. The problem is that I can't write tests that are testing that certain exceptions are thrown using the @Test(expected...) annotation.
I've tried it with this simple scenario here:
@Test(expected=IndexOutOfBoundsException.class)
public void testIndexOutOfBoundsException() {
ArrayList emptyList = new ArrayList();
Object o = emptyList.get(0);
}
and I still get a failure.
Is there something that I'm missing?
Thanks...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules