Skip to content

Commit 3bc7ed5

Browse files
committed
fixes
Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>
1 parent 65369d4 commit 3bc7ed5

File tree

1 file changed

+40
-33
lines changed

1 file changed

+40
-33
lines changed

rsocket-test/src/main/java/io/rsocket/test/TransportTest.java

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@
4848
import org.assertj.core.api.Assertions;
4949
import org.assertj.core.api.Assumptions;
5050
import org.junit.jupiter.api.AfterEach;
51+
import org.junit.jupiter.api.BeforeEach;
5152
import org.junit.jupiter.api.DisplayName;
5253
import org.junit.jupiter.api.Test;
5354
import org.reactivestreams.Subscription;
5455
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.*;
5957
import reactor.core.scheduler.Scheduler;
6058
import reactor.core.scheduler.Schedulers;
6159
import reactor.test.StepVerifier;
@@ -85,38 +83,47 @@ static String read(String resourceName) {
8583
}
8684
}
8785

86+
@BeforeEach
87+
default void setup() {
88+
Hooks.onOperatorDebug();
89+
}
90+
8891
@AfterEach
8992
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-
11293
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();
120127
}
121128
}
122129

0 commit comments

Comments
 (0)