Skip to content

Commit 01b6a05

Browse files
committed
feat(java): add more tests
1 parent 8364b78 commit 01b6a05

File tree

1 file changed

+19
-7
lines changed
  • sdk/java/src/test/java/com/kucoin/universal/sdk/test/e2e/ws/spot

1 file changed

+19
-7
lines changed

sdk/java/src/test/java/com/kucoin/universal/sdk/test/e2e/ws/spot/PrivateTest.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.fasterxml.jackson.databind.ObjectMapper;
44
import com.kucoin.universal.sdk.api.DefaultKucoinClient;
55
import com.kucoin.universal.sdk.api.KucoinClient;
6-
import com.kucoin.universal.sdk.generate.spot.spotprivate.OrderV2Event;
76
import com.kucoin.universal.sdk.generate.spot.spotprivate.SpotPrivateWs;
87
import com.kucoin.universal.sdk.model.ClientOption;
98
import 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

0 commit comments

Comments
 (0)