### Question:
RetryStrategy implements Function<Flowable<Throwable>, Flowable<?>> { public static Builder onlyIf(Predicate<Throwable> predicate) { return new Builder(predicate); } RetryStrategy(Builder builder); @Override Flowable<?> apply(Flowable<Throwable> errors); static Builder always(); @SafeVarargs @SuppressWarnings("varargs") static Builder ifInstanceOf(Class<? extends Throwable>... classes); static Builder onlyIf(Predicate<Throwable> predicate);  }### Answer:
@Test void testOnlyIf() throws Exception { errorSource(2) .retryWhen( RetryStrategy.onlyIf( e -> e instanceof RuntimeException && "Error #1".equals(e.getMessage())) .build()) .test() .await() .assertError(RuntimeException.class) .assertErrorMessage("Error #2"); errorSource(1) .retryWhen(RetryStrategy.onlyIf(e -> e instanceof Error).build()) .test() .await() .assertError(RuntimeException.class) .assertErrorMessage("Error #1"); }