You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by D&J Gredler <dj...@gmail.com> on 2006/09/14 20:45:45 UTC

[OT] unit testing error-handling code

Has anyone found an easy way to unit test code that only runs when
Class.forName(String) throws a NoClassDefFoundError?

        try {
            c = Class.forName( className );
        }
        catch( NoClassDefFoundError e ) {
            // code to be tested
        }

It seems back asswards to be trying to *cause* this error :-)