KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I would like to write a test for IndexOutOfBoundsException . Keep in mind that we are supposed to use JUnit 3. My code: public boolean ajouter(int indice, T element) { if (indice < 0 || indice > (maListe.size() - 1)) { throw new IndexOutOfBoundsException(); } else if (element != null && !maListe.contains(element)) { maListe.set(indice, element); return true; } } After some research, I found that you can do this with JUnit 4 using @Test(expected = IndexOutOfBoundsException.class) but no where did I find how to do this in JUnit 3. How can I test this using JUnit 3?
Tags (comma-separated)
Save Edits
Cancel