/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Throwable if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Throwable { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw errors.get(0); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Exception or Error if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Exception { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw Throwables.rethrowAsException(errors.get(0)); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Throwable if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Throwable { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw errors.get(0); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Throwable if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Throwable { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw errors.get(0); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Throwable if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Throwable { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw errors.get(0); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
/** * A helper to safely execute multiple statements in one.<br/> * <p> * Will execute all statements even if they fail, all exceptions will be kept. If multiple {@link Statement}s * fail, a {@link MultipleFailureException} will be thrown. * * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a> * @version $Revision: $ */ private void multiExecute(Statement... statements) throws Throwable { List<Throwable> exceptions = new ArrayList<Throwable>(); for (Statement command : statements) { try { command.evaluate(); } catch (Throwable e) { exceptions.add(e); } } if (exceptions.isEmpty()) { return; } if (exceptions.size() == 1) { throw exceptions.get(0); } throw new MultipleFailureException(exceptions); }
/** * A helper to safely execute multiple statements in one.<br/> * * Will execute all statements even if they fail, all exceptions will be kept. If multiple {@link Statement}s fail, a * {@link MultipleFailureException} will be thrown. * * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a> * @version $Revision: $ */ private void multiExecute(Statement... statements) throws Throwable { List<Throwable> exceptions = new ArrayList<Throwable>(); for (Statement command : statements) { try { command.evaluate(); } catch (Exception e) { exceptions.add(e); } } if (exceptions.isEmpty()) { return; } if (exceptions.size() == 1) { throw exceptions.get(0); } throw new MultipleFailureException(exceptions); }
/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Exception or Error if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Exception { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw Throwables.rethrowAsException(errors.get(0)); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
/** * A helper to safely execute multiple statements in one.<br/> * <p> * Will execute all statements even if they fail, all exceptions will be kept. If multiple {@link Statement}s * fail, a {@link MultipleFailureException} will be thrown. * * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a> * @version $Revision: $ */ private void multiExecute(Statement... statements) throws Throwable { List<Throwable> exceptions = new ArrayList<Throwable>(); for (Statement command : statements) { try { command.evaluate(); } catch (Throwable e) { exceptions.add(e); } } if (exceptions.isEmpty()) { return; } if (exceptions.size() == 1) { throw exceptions.get(0); } throw new MultipleFailureException(exceptions); }
/** * Asserts that a list of throwables is empty. If it isn't empty, * will throw {@link MultipleFailureException} (if there are * multiple throwables in the list) or the first element in the list * (if there is only one element). * * @param errors list to check * @throws Exception or Error if the list is not empty */ @SuppressWarnings("deprecation") public static void assertEmpty(List<Throwable> errors) throws Exception { if (errors.isEmpty()) { return; } if (errors.size() == 1) { throw Throwables.rethrowAsException(errors.get(0)); } /* * Many places in the code are documented to throw * org.junit.internal.runners.model.MultipleFailureException. * That class now extends this one, so we throw the internal * exception in case developers have tests that catch * MultipleFailureException. */ throw new org.junit.internal.runners.model.MultipleFailureException(errors); } }
@Override public void evaluate() throws Throwable { List<Throwable> errors = new ArrayList<Throwable>(); errors.clear(); try { prev.evaluate(); } catch (Throwable e) { errors.add(e); } finally { for (Statement after : afters) { try { after.evaluate(); } catch (Throwable e) { errors.add(e); } } } if (!errors.isEmpty()) { throw new MultipleFailureException(errors); } } }
@Override public void evaluate() throws Throwable { List<Throwable> errors = new ArrayList<Throwable>(); errors.clear(); try { prev.evaluate(); } catch (Throwable e) { errors.add(e); } finally { for (Statement after : afters) { try { after.evaluate(); } catch (Throwable e) { errors.add(e); } } } if (!errors.isEmpty()) { throw new MultipleFailureException(errors); } } }
@Override public void evaluate() throws Throwable { List<Throwable> errors = new ArrayList<Throwable>(); try { next.evaluate(); } catch (Throwable e) { errors.add(e); } finally { for (Map.Entry<Object, List<FrameworkMethod>> each : targetsToMethods.entrySet()) { for (FrameworkMethod after : each.getValue()) { try { after.invokeExplosively(each.getKey()); } catch (Throwable e) { errors.add(e); } } } } if (errors.isEmpty()) return; if (errors.size() == 1) throw errors.get(0); throw new MultipleFailureException(errors); }
throw new MultipleFailureException(exceptions);
throw errors.get(0); throw new MultipleFailureException(errors);
@Override public void evaluate() throws Throwable { List<Throwable> fErrors = new ArrayList<Throwable>(); fErrors.clear(); try { next.evaluate(); } catch (Throwable e) { fErrors.add(e); } finally { for (FrameworkMethod each : afters) try { each.invokeExplosively(target, runner.injectParameters(each.getMethod())); } catch (Throwable e) { fErrors.add(e); } } if (fErrors.isEmpty()) return; if (fErrors.size() == 1) throw fErrors.get(0); throw new MultipleFailureException(fErrors); } }
throw exceptions.get(0); throw new MultipleFailureException(exceptions);
throw exceptions.get(0); throw new MultipleFailureException(exceptions);
throw exceptions.get(0); throw new MultipleFailureException(exceptions);
throw exceptions.get(0); throw new MultipleFailureException(exceptions);