|
16 | 16 | import static org.junit.Assert.*;
|
17 | 17 |
|
18 | 18 | import java.io.IOException;
|
| 19 | +import java.util.HashMap; |
19 | 20 | import java.util.List;
|
| 21 | +import java.util.Map; |
20 | 22 |
|
21 | 23 | import org.junit.Test;
|
22 | 24 | import org.reactivestreams.*;
|
@@ -931,4 +933,26 @@ public void subscribe(FlowableEmitter<Object> e) throws Exception {
|
931 | 933 | }
|
932 | 934 | }
|
933 | 935 | }
|
| 936 | + |
| 937 | + @Test |
| 938 | + public void emittersHasToString() { |
| 939 | + Map<BackpressureStrategy, Class<? extends FlowableEmitter>> emitterMap = |
| 940 | + new HashMap<BackpressureStrategy, Class<? extends FlowableEmitter>>(); |
| 941 | + |
| 942 | + emitterMap.put(BackpressureStrategy.MISSING, FlowableCreate.MissingEmitter.class); |
| 943 | + emitterMap.put(BackpressureStrategy.ERROR, FlowableCreate.ErrorAsyncEmitter.class); |
| 944 | + emitterMap.put(BackpressureStrategy.DROP, FlowableCreate.DropAsyncEmitter.class); |
| 945 | + emitterMap.put(BackpressureStrategy.LATEST, FlowableCreate.LatestAsyncEmitter.class); |
| 946 | + emitterMap.put(BackpressureStrategy.BUFFER, FlowableCreate.BufferAsyncEmitter.class); |
| 947 | + |
| 948 | + for (final Map.Entry<BackpressureStrategy, Class<? extends FlowableEmitter>> entry : emitterMap.entrySet()) { |
| 949 | + Flowable.create(new FlowableOnSubscribe<Object>() { |
| 950 | + @Override |
| 951 | + public void subscribe(FlowableEmitter<Object> emitter) throws Exception { |
| 952 | + assertTrue(emitter.toString().contains(entry.getValue().getSimpleName())); |
| 953 | + assertTrue(emitter.serialize().toString().contains(entry.getValue().getSimpleName())); |
| 954 | + } |
| 955 | + }, entry.getKey()).test().assertEmpty(); |
| 956 | + } |
| 957 | + } |
934 | 958 | }
|
0 commit comments