Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JUnit4StackTraceWriter |
|
| 1.0;1 |
1 | package org.apache.maven.surefire.common.junit4; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import org.apache.maven.surefire.report.StackTraceWriter; | |
23 | import org.junit.runner.notification.Failure; | |
24 | ||
25 | /** | |
26 | * Writes out a specific {@link org.junit.runner.notification.Failure} for | |
27 | * surefire as a stacktrace. | |
28 | * | |
29 | * @author Karl M. Davis | |
30 | */ | |
31 | public class JUnit4StackTraceWriter | |
32 | implements StackTraceWriter | |
33 | { | |
34 | // Member Variables | |
35 | private final Failure junitFailure; | |
36 | ||
37 | /** | |
38 | * Constructor. | |
39 | * | |
40 | * @param junitFailure the {@link Failure} that this will be operating on | |
41 | */ | |
42 | public JUnit4StackTraceWriter( Failure junitFailure ) | |
43 | 0 | { |
44 | 0 | this.junitFailure = junitFailure; |
45 | 0 | } |
46 | ||
47 | /* | |
48 | * (non-Javadoc) | |
49 | * | |
50 | * @see org.apache.maven.surefire.report.StackTraceWriter#writeTraceToString() | |
51 | */ | |
52 | public String writeTraceToString() | |
53 | { | |
54 | 0 | return junitFailure.getTrace(); |
55 | } | |
56 | ||
57 | /** | |
58 | * At the moment, returns the same as {@link #writeTraceToString()}. | |
59 | * | |
60 | * @see org.apache.maven.surefire.report.StackTraceWriter#writeTrimmedTraceToString() | |
61 | */ | |
62 | public String writeTrimmedTraceToString() | |
63 | { | |
64 | 0 | return junitFailure.getTrace(); |
65 | } | |
66 | ||
67 | /** | |
68 | * Returns the exception associated with this failure. | |
69 | * | |
70 | * @see org.apache.maven.surefire.report.StackTraceWriter#getThrowable() | |
71 | */ | |
72 | public Throwable getThrowable() | |
73 | { | |
74 | 0 | return junitFailure.getException(); |
75 | } | |
76 | ||
77 | } |