1 package org.apache.archiva.web.test.tools;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
22 import org.junit.runners.model.FrameworkMethod;
23 import org.junit.runners.model.MultipleFailureException;
24 import org.junit.runners.model.Statement;
26 import java.util.ArrayList;
27 import java.util.List;
30 * @author Olivier Lamy
32 public class RunAfterSeleniumFailures
36 private final Statement next;
38 private final Object target;
40 private final List<FrameworkMethod> afterFailures;
42 public RunAfterSeleniumFailures( Statement next, List<FrameworkMethod> afterFailures, Object target )
45 this.afterFailures = afterFailures;
50 public void evaluate()
53 List<Throwable> errors = new ArrayList<Throwable>();
62 for ( FrameworkMethod each : afterFailures )
66 each.invokeExplosively( target, t );
68 catch ( Throwable t2 )
74 if ( errors.isEmpty() )
78 if ( errors.size() == 1 )
80 throw errors.get( 0 );
82 throw new MultipleFailureException( errors );