KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit4 > runner > FailureException


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * David Saff (saff@mit.edu) - initial API and implementation
10  * (bug 102632: [JUnit] Support for JUnit 4.)
11  *******************************************************************************/

12
13 /**
14  *
15  */

16 package org.eclipse.jdt.internal.junit4.runner;
17
18 import junit.framework.ComparisonFailure;
19
20 import org.eclipse.jdt.internal.junit.runner.MessageIds;
21
22 public class FailureException {
23     private final Throwable JavaDoc exception;
24
25     public FailureException(Throwable JavaDoc exception) {
26         this.exception = exception;
27     }
28
29     public String JavaDoc getStatus() {
30         if (exception instanceof AssertionError JavaDoc)
31             return MessageIds.TEST_FAILED;
32         if (exception instanceof ComparisonFailure)
33             return MessageIds.TEST_FAILED;
34         return MessageIds.TEST_ERROR;
35     }
36 }
Popular Tags