1b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot/**
2b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot *
3b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot */
4b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotpackage org.junit.experimental.results;
5b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
6b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport java.util.List;
7b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
8b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport org.junit.runner.Result;
9b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport org.junit.runner.notification.Failure;
10b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport org.junit.runner.notification.RunListener;
11b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
12b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotclass FailureList {
13b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	private final List<Failure> failures;
14b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
15b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	public FailureList(List<Failure> failures) {
16b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		this.failures= failures;
17b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	}
18b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
19b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	public Result result() {
20b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		Result result= new Result();
21b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		RunListener listener= result.createListener();
22b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		for (Failure failure : failures) {
23b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot			try {
24b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot				listener.testFailure(failure);
25b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot			} catch (Exception e) {
26b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot				throw new RuntimeException("I can't believe this happened");
27b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot			}
28b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		}
29b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		return result;
30b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	}
31b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot}