|
47 | 47 | import org.junit.jupiter.api.Test;
|
48 | 48 | import org.junit.jupiter.params.ParameterizedTest;
|
49 | 49 | import org.junit.jupiter.params.provider.MethodSource;
|
| 50 | +import org.reactivestreams.Subscriber; |
50 | 51 | import org.reactivestreams.Subscription;
|
51 | 52 | import software.amazon.awssdk.core.FileTransformerConfiguration;
|
52 | 53 | import software.amazon.awssdk.core.FileTransformerConfiguration.FileWriteOption;
|
@@ -331,12 +332,25 @@ private static void stubException(String newContent, FileAsyncResponseTransforme
|
331 | 332 |
|
332 | 333 | RuntimeException runtimeException = new RuntimeException("oops");
|
333 | 334 | ByteBuffer content = ByteBuffer.wrap(newContent.getBytes(StandardCharsets.UTF_8));
|
334 |
| - transformer.onStream(SdkPublisher.adapt(Flowable.just(content, content))); |
| 335 | + SdkPublisher<ByteBuffer> idlePublisher = new SdkPublisher<ByteBuffer>() { |
| 336 | + @Override |
| 337 | + public void subscribe(Subscriber<? super ByteBuffer> subscriber) { |
| 338 | + subscriber.onSubscribe(new Subscription() { |
| 339 | + @Override |
| 340 | + public void request(long l) { |
| 341 | + subscriber.onNext(content); |
| 342 | + } |
| 343 | + |
| 344 | + @Override |
| 345 | + public void cancel() { |
| 346 | + } |
| 347 | + }); |
| 348 | + } |
| 349 | + }; |
| 350 | + transformer.onStream(idlePublisher); |
335 | 351 | transformer.exceptionOccurred(runtimeException);
|
336 | 352 |
|
337 |
| - assertThat(future).failsWithin(1, TimeUnit.SECONDS) |
338 |
| - .withThrowableOfType(ExecutionException.class) |
339 |
| - .withCause(runtimeException); |
| 353 | + assertThatThrownBy(future::join).isInstanceOf(Exception.class); |
340 | 354 | }
|
341 | 355 |
|
342 | 356 | private static SdkPublisher<ByteBuffer> testPublisher(String content) {
|
|
0 commit comments