April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Best Practices for Designing API (cont.)
4.Document exceptions
nYou can use Javadoc's @throws tag to document both checked and unchecked exceptions that your API throws. Or write unit tests to document exceptions.  
n
npublic void testIndexOutOfBoundsException() {
n  ArrayList blankList = new ArrayList();
n  try {
n    blankList.get(10);
n    fail("Should raise an IndexOutOfBoundsException");
n  } catch (IndexOutOfBoundsException success) {}
n}