001    package org.junit.runners.model;
002    
003    import java.util.Arrays;
004    import java.util.List;
005    
006    /**
007     * Represents one or more problems encountered while initializing a Runner
008     *
009     * @since 4.5
010     */
011    public class InitializationError extends Exception {
012        private static final long serialVersionUID = 1L;
013        private final List<Throwable> errors;
014    
015        /**
016         * Construct a new {@code InitializationError} with one or more
017         * errors {@code errors} as causes
018         */
019        public InitializationError(List<Throwable> errors) {
020            this.errors = errors;
021        }
022    
023        public InitializationError(Throwable error) {
024            this(Arrays.asList(error));
025        }
026    
027        /**
028         * Construct a new {@code InitializationError} with one cause
029         * with message {@code string}
030         */
031        public InitializationError(String string) {
032            this(new Exception(string));
033        }
034    
035        /**
036         * Returns one or more Throwables that led to this initialization error.
037         */
038        public List<Throwable> getCauses() {
039            return errors;
040        }
041    }