|
9 | 9 | /** |
10 | 10 | * A test utility class for recording and executing assertions about the presence (or absence) of exceptions |
11 | 11 | * |
| 12 | + * @deprecated use {@link net.openhft.chronicle.testframework.exception.ExceptionTracker} |
| 13 | + * |
12 | 14 | * @param <T> The class used to represent thrown exceptions |
13 | 15 | */ |
14 | | -public interface ExceptionTracker<T> { |
| 16 | +@Deprecated(/* To be removed in x.25 */) |
| 17 | +public interface ExceptionTracker<T> extends net.openhft.chronicle.testframework.exception.ExceptionTracker<T> { |
15 | 18 |
|
16 | 19 | /** |
17 | | - * Create an exception tracker |
18 | | - * |
19 | | - * @param messageExtractor The function used to extract the String message or description from T |
20 | | - * @param throwableExtractor The function used to extract the Throwable from T |
21 | | - * @param resetRunnable A Runnable that will be called at the end of {@link #checkExceptions()} |
22 | | - * @param exceptions A map that will be populated with T as the key and the count of occurrences of T as a value |
23 | | - * @param ignorePredicate A predicate that will exclude T's from consideration |
24 | | - * @param exceptionRenderer A function to render T as a String (used when dumping exceptions) |
| 20 | + * @deprecated use {@link net.openhft.chronicle.testframework.exception.ExceptionTracker#create(Function, Function, Runnable, Map, Predicate, Function)} |
25 | 21 | */ |
| 22 | + @Deprecated(/* To be removed in x.25 */) |
26 | 23 | static <T> ExceptionTracker<T> create(@NotNull final Function<T, String> messageExtractor, |
27 | | - @NotNull final Function<T, Throwable> throwableExtractor, |
28 | | - @NotNull final Runnable resetRunnable, |
29 | | - @NotNull final Map<T, Integer> exceptions, |
30 | | - @NotNull final Predicate<T> ignorePredicate, |
31 | | - @NotNull final Function<T, String> exceptionRenderer) { |
32 | | - return new VanillaExceptionTracker<>( |
33 | | - messageExtractor, |
34 | | - throwableExtractor, |
35 | | - resetRunnable, |
36 | | - exceptions, |
37 | | - ignorePredicate, |
38 | | - exceptionRenderer); |
| 24 | + @NotNull final Function<T, Throwable> throwableExtractor, |
| 25 | + @NotNull final Runnable resetRunnable, |
| 26 | + @NotNull final Map<T, Integer> exceptions, |
| 27 | + @NotNull final Predicate<T> ignorePredicate, |
| 28 | + @NotNull final Function<T, String> exceptionRenderer) { |
| 29 | + return (ExceptionTracker<T>) net.openhft.chronicle.testframework.exception.ExceptionTracker.create( |
| 30 | + messageExtractor, throwableExtractor, resetRunnable, exceptions, ignorePredicate, exceptionRenderer); |
39 | 31 | } |
40 | | - |
41 | | - /** |
42 | | - * Require than an exception containing the specified string is thrown during the test |
43 | | - * |
44 | | - * @param message The string to require |
45 | | - */ |
46 | | - void expectException(String message); |
47 | | - |
48 | | - /** |
49 | | - * Require that an exception matching the specified predicate is thrown |
50 | | - * |
51 | | - * @param predicate The predicate used to match exceptions |
52 | | - * @param description The description of the exceptions being required |
53 | | - */ |
54 | | - void expectException(Predicate<T> predicate, String description); |
55 | | - |
56 | | - /** |
57 | | - * Ignore exceptions containing the specified string |
58 | | - * |
59 | | - * @param message The string to ignore |
60 | | - */ |
61 | | - void ignoreException(String message); |
62 | | - |
63 | | - /** |
64 | | - * Ignore exceptions matching the specified predicate |
65 | | - * |
66 | | - * @param predicate The predicate to match the exception |
67 | | - * @param description The description of the exceptions being ignored |
68 | | - */ |
69 | | - void ignoreException(Predicate<T> predicate, String description); |
70 | | - |
71 | | - /** |
72 | | - * Determine if the tracker contains an exception matching the predicate |
73 | | - * |
74 | | - * @param predicate The predicate to match the exception |
75 | | - */ |
76 | | - boolean hasException(Predicate<T> predicate); |
77 | | - |
78 | | - /** |
79 | | - * Call this in @After to ensure |
80 | | - * <ul> |
81 | | - * <li>No non-ignored exceptions were thrown</li> |
82 | | - * <li>There is an exception matching each of the expected predicates</li> |
83 | | - * </ul> |
84 | | - * <p> |
85 | | - * Implementations should throw an exception and print a summary of the assertion(s) violated |
86 | | - */ |
87 | | - void checkExceptions(); |
88 | 32 | } |
0 commit comments