001package org.junit.runners.model;
002
003import java.util.Arrays;
004import java.util.List;
005
006/**
007 * Represents one or more problems encountered while initializing a Runner
008 *
009 * @since 4.5
010 */
011public class InitializationError extends Exception {
012    private static final long serialVersionUID = 1L;
013    private final List<Throwable> fErrors;
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        fErrors = 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 fErrors;
040    }
041}