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 :-)