void (TestResult testResult, String message) { String processedTestsMessage = myRunTests <= 0 ? "None of tests was run" : myRunTests + " tests processed"; try { testResult.startTest(this); testResult.addError(this, new Throwable(processedTestsMessage + " before: " + message)); testResult.endTest(this); } catch (Exception e) { e.printStackTrace(); } }