@Override public Constructor<String> run() { Constructor<String> constr; try { constr = String.class.getDeclaredConstructor(char[].class, boolean.class); constr.setAccessible(true); } catch (NoSuchMethodException ex) { try { constr = String.class.getDeclaredConstructor(int.class, int.class, char[].class); constr.setAccessible(true); } catch (NoSuchMethodException ex2) { ex2.addSuppressed(ex); Logger logger = Logger.getLogger(Strings.class.getName()); logger.warning("Building String from char[] without copy not supported"); logger.log(Level.FINEST, "Exception detail", ex2); constr = null; } } return constr; } });
@Override public Constructor<String> run() { Constructor<String> constr; try { constr = String.class.getDeclaredConstructor(char[].class, boolean.class); constr.setAccessible(true); } catch (NoSuchMethodException ex) { try { constr = String.class.getDeclaredConstructor(int.class, int.class, char[].class); constr.setAccessible(true); } catch (NoSuchMethodException ex2) { ex2.addSuppressed(ex); Logger logger = Logger.getLogger(Strings.class.getName()); logger.warning("Building String from char[] without copy not supported"); logger.log(Level.FINEST, "Exception detail", ex2); constr = null; } } return constr; } });
public static MethodInstance newFailureMethodInstance(Exception e, XmlTest xmlTest, ITestContext context) { Method failMethod = null; try { failMethod = TestFrameworkFailure.class.getMethod("fail"); } catch (NoSuchMethodException e1) { e1.addSuppressed(e); e1.printStackTrace(System.err); throw new TestNGException(e1); } TestFrameworkFailure testInstance = new TestFrameworkFailure(e); TestNGMethod testNGMethod = new TestNGMethod(failMethod, context.getSuite().getAnnotationFinder(), xmlTest, testInstance); ITestClass testClass = new FakeTestClass(testNGMethod, testInstance, xmlTest); testNGMethod.setTestClass(testClass); return new MethodInstance(testNGMethod); }