()
| 3028 | } |
| 3029 | |
| 3030 | @Test |
| 3031 | public void retry() { |
| 3032 | Maybe.just(1).retry().test().assertResult(1); |
| 3033 | |
| 3034 | Maybe.just(1).retry(5).test().assertResult(1); |
| 3035 | |
| 3036 | Maybe.just(1).retry(Functions.alwaysTrue()).test().assertResult(1); |
| 3037 | |
| 3038 | Maybe.just(1).retry(5, Functions.alwaysTrue()).test().assertResult(1); |
| 3039 | |
| 3040 | Maybe.just(1).retry(new BiPredicate<Integer, Throwable>() { |
| 3041 | @Override |
| 3042 | public boolean test(Integer a, Throwable e) throws Exception { |
| 3043 | return true; |
| 3044 | } |
| 3045 | }).test().assertResult(1); |
| 3046 | |
| 3047 | Maybe.just(1).retryUntil(new BooleanSupplier() { |
| 3048 | @Override |
| 3049 | public boolean getAsBoolean() throws Exception { |
| 3050 | return false; |
| 3051 | } |
| 3052 | }).test().assertResult(1); |
| 3053 | |
| 3054 | Maybe.just(1).retryWhen(new Function<Flowable<? extends Throwable>, Publisher<Object>>() { |
| 3055 | @SuppressWarnings({ "rawtypes", "unchecked" }) |
| 3056 | @Override |
| 3057 | public Publisher<Object> apply(Flowable<? extends Throwable> v) throws Exception { |
| 3058 | return (Publisher)v; |
| 3059 | } |
| 3060 | }).test().assertResult(1); |
| 3061 | |
| 3062 | final AtomicInteger calls = new AtomicInteger(); |
| 3063 | try { |
| 3064 | Maybe.error(new Supplier<Throwable>() { |
| 3065 | @Override |
| 3066 | public Throwable get() { |
| 3067 | calls.incrementAndGet(); |
| 3068 | return new TestException(); |
| 3069 | } |
| 3070 | }).retry(5).test(); |
| 3071 | } finally { |
| 3072 | assertEquals(6, calls.get()); |
| 3073 | } |
| 3074 | } |
| 3075 | |
| 3076 | @Test |
| 3077 | public void onErrorResumeWithEmpty() { |
no test coverage detected