File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
sdk/java/src/test/java/com/kucoin/universal/sdk/test/e2e/ws/spot Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 33import com .fasterxml .jackson .databind .ObjectMapper ;
44import com .kucoin .universal .sdk .api .DefaultKucoinClient ;
55import com .kucoin .universal .sdk .api .KucoinClient ;
6- import com .kucoin .universal .sdk .generate .spot .spotprivate .OrderV2Event ;
76import com .kucoin .universal .sdk .generate .spot .spotprivate .SpotPrivateWs ;
87import com .kucoin .universal .sdk .model .ClientOption ;
98import com .kucoin .universal .sdk .model .Constants ;
@@ -124,13 +123,26 @@ public void testOrderV1() {
124123 }
125124
126125 @ Test
127- public void testOrderV2 () throws InterruptedException {
126+ public void testOrderV2 () {
128127 CountDownLatch gotEvent = new CountDownLatch (1 );
129- api .orderV2 (
130- (String topic , String subject , OrderV2Event data ) -> {
131- log .info ("event: {}" , data .toString ());
132- });
133- Thread .sleep (1000000000 );
128+ CompletableFuture .supplyAsync (
129+ () ->
130+ api .orderV2 (
131+ (__ , ___ , event ) -> {
132+ log .info ("event: {}" , event .toString ());
133+ gotEvent .countDown ();
134+ }))
135+ .thenApply (
136+ id -> {
137+ try {
138+ gotEvent .await ();
139+ } catch (InterruptedException e ) {
140+ throw new RuntimeException (e );
141+ }
142+ return id ;
143+ })
144+ .thenAccept (id -> api .unSubscribe (id ))
145+ .join ();
134146 }
135147
136148 @ Test
You can’t perform that action at this time.
0 commit comments