1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.spf4j.test.log;
17
18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19 import org.hamcrest.Matcher;
20 import org.hamcrest.Matchers;
21
22
23
24
25 public final class UncaughtExceptionDetail {
26
27 private final Thread thread;
28 private final Throwable throwable;
29
30 @SuppressFBWarnings("EI_EXPOSE_REP2")
31 public UncaughtExceptionDetail(final Thread thread, final Throwable throwable) {
32 this.thread = thread;
33 this.throwable = throwable;
34 }
35
36 @SuppressFBWarnings("EI_EXPOSE_REP")
37 public Thread getThread() {
38 return thread;
39 }
40
41 @SuppressFBWarnings("EI_EXPOSE_REP")
42 public Throwable getThrowable() {
43 return throwable;
44 }
45
46 @Override
47 public String toString() {
48 return "UncaughtException{" + "thread=" + thread + ", throwable=" + throwable + '}';
49 }
50
51 public static Matcher<UncaughtExceptionDetail> hasThrowable(final Matcher<Throwable> tMatcher) {
52 return Matchers.hasProperty("throwable", tMatcher);
53 }
54
55 public static Matcher<UncaughtExceptionDetail> hasThread(final Matcher<Thread> tMatcher) {
56 return Matchers.hasProperty("thread", tMatcher);
57 }
58
59 }