001
014
015 package com.liferay.portal.kernel.test;
016
017 import java.util.ArrayList;
018 import java.util.List;
019
020 import org.junit.runners.model.MultipleFailureException;
021 import org.junit.runners.model.Statement;
022
023
026 public class RunAfterTestClassesCallback extends AbstractStatementCallback {
027
028 public RunAfterTestClassesCallback(
029 Statement statement, TestContextHandler testContextHandler) {
030
031 super(statement, testContextHandler);
032 }
033
034 @Override
035 public void evaluate() throws Throwable {
036 List<Throwable> throwables = new ArrayList<Throwable>();
037
038 Statement statement = getStatement();
039
040 if ( statement != null) {
041 try {
042 statement.evaluate();
043 }
044 catch (Throwable t) {
045 throwables.add(t);
046 }
047 }
048
049 try {
050 TestContextHandler testContextHandler = getTestContextHandler();
051
052 testContextHandler.runAfterTestClasses();
053 }
054 catch (Exception e) {
055 throwables.add(e);
056 }
057
058 if (!throwables.isEmpty()) {
059 throw new MultipleFailureException(throwables);
060 }
061 }
062
063 }