DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Oleg has posted 1 posts at DZone. View Full User Profile

Exception Assertion Template For Eclipse

03.15.2007
| 6645 views |
  • submit to reddit
        Eclipse template for exception assertion (Create template in Eclipse > Preferences > Java > Editor > Templates > New ... OK)

How to use: 
1. Select code throwing exception
2. Alt + Shift + Z -> select corresponding template.

        try
        {
            ${line_selection}${cursor}
            fail("${Exception} expected.");
        }
        catch (${Exception} e)
        {
            assertEquals(${message}, e.getMessage());
        }