|
48 | 48 | import org.assertj.core.api.Assertions; |
49 | 49 | import org.assertj.core.api.Assumptions; |
50 | 50 | import org.junit.jupiter.api.AfterEach; |
| 51 | +import org.junit.jupiter.api.BeforeEach; |
51 | 52 | import org.junit.jupiter.api.DisplayName; |
52 | 53 | import org.junit.jupiter.api.Test; |
53 | 54 | import org.reactivestreams.Subscription; |
54 | 55 | import reactor.core.*; |
55 | | -import reactor.core.publisher.Flux; |
56 | | -import reactor.core.publisher.Mono; |
57 | | -import reactor.core.publisher.Operators; |
58 | | -import reactor.core.publisher.Sinks; |
| 56 | +import reactor.core.publisher.*; |
59 | 57 | import reactor.core.scheduler.Scheduler; |
60 | 58 | import reactor.core.scheduler.Schedulers; |
61 | 59 | import reactor.test.StepVerifier; |
@@ -85,38 +83,47 @@ static String read(String resourceName) { |
85 | 83 | } |
86 | 84 | } |
87 | 85 |
|
| 86 | + @BeforeEach |
| 87 | + default void setup() { |
| 88 | + Hooks.onOperatorDebug(); |
| 89 | + } |
| 90 | + |
88 | 91 | @AfterEach |
89 | 92 | default void close() { |
90 | | - getTransportPair().responder.awaitAllInteractionTermination(getTimeout()); |
91 | | - getTransportPair().dispose(); |
92 | | - getTransportPair().awaitClosed(); |
93 | | - RuntimeException throwable = |
94 | | - new RuntimeException() { |
95 | | - @Override |
96 | | - public synchronized Throwable fillInStackTrace() { |
97 | | - return this; |
98 | | - } |
99 | | - |
100 | | - @Override |
101 | | - public String getMessage() { |
102 | | - return Arrays.toString(getSuppressed()); |
103 | | - } |
104 | | - }; |
105 | | - |
106 | | - try { |
107 | | - getTransportPair().byteBufAllocator2.assertHasNoLeaks(); |
108 | | - } catch (Throwable t) { |
109 | | - throwable = Exceptions.addSuppressed(throwable, t); |
110 | | - } |
111 | | - |
112 | 93 | try { |
113 | | - getTransportPair().byteBufAllocator1.assertHasNoLeaks(); |
114 | | - } catch (Throwable t) { |
115 | | - throwable = Exceptions.addSuppressed(throwable, t); |
116 | | - } |
117 | | - |
118 | | - if (throwable.getSuppressed().length > 0) { |
119 | | - throw throwable; |
| 94 | + getTransportPair().responder.awaitAllInteractionTermination(getTimeout()); |
| 95 | + getTransportPair().dispose(); |
| 96 | + getTransportPair().awaitClosed(); |
| 97 | + RuntimeException throwable = |
| 98 | + new RuntimeException() { |
| 99 | + @Override |
| 100 | + public synchronized Throwable fillInStackTrace() { |
| 101 | + return this; |
| 102 | + } |
| 103 | + |
| 104 | + @Override |
| 105 | + public String getMessage() { |
| 106 | + return Arrays.toString(getSuppressed()); |
| 107 | + } |
| 108 | + }; |
| 109 | + |
| 110 | + try { |
| 111 | + getTransportPair().byteBufAllocator2.assertHasNoLeaks(); |
| 112 | + } catch (Throwable t) { |
| 113 | + throwable = Exceptions.addSuppressed(throwable, t); |
| 114 | + } |
| 115 | + |
| 116 | + try { |
| 117 | + getTransportPair().byteBufAllocator1.assertHasNoLeaks(); |
| 118 | + } catch (Throwable t) { |
| 119 | + throwable = Exceptions.addSuppressed(throwable, t); |
| 120 | + } |
| 121 | + |
| 122 | + if (throwable.getSuppressed().length > 0) { |
| 123 | + throw throwable; |
| 124 | + } |
| 125 | + } finally { |
| 126 | + Hooks.resetOnOperatorDebug(); |
120 | 127 | } |
121 | 128 | } |
122 | 129 |
|
|
0 commit comments