void () { String causeMsg = "com.mypackage.MyImaginaryClass"; ClassNotFoundException rootCause = new ClassNotFoundException(causeMsg); Throwable error = new Throwable(rootCause); RuntimeException realCause = myErrorHandler.getUserFriendlyError(null, error, myProjectPath, null); assertTrue(realCause.getMessage().contains("Unable to load class 'com.mypackage.MyImaginaryClass'.")); }