@Override public Single<Object> apply(Flowable<Object> f) throws Exception { return f.elementAt(0, 1); } });
@Override public Object apply(Flowable<Integer> f) throws Exception { return f.elementAt(0); } }, false, null, 1);
@Override public Object apply(Flowable<Integer> f) throws Exception { return f.elementAt(0, 1); } }, false, null, 1, 1);
@Override public Object apply(Flowable<Integer> f) throws Exception { return f.elementAt(0, 1).toFlowable(); } }, false, null, 1, 1);
@Test(expected = NullPointerException.class) public void elementAtNull() { just1.elementAt(1, null); }
@Override public Publisher<Object> apply(Flowable<Object> f) throws Exception { return f.elementAt(0).toFlowable(); } });
@Override public Object apply(Flowable<Integer> f) throws Exception { return f.elementAt(0).toFlowable(); } }, false, null, 1);
@Test(expected = IndexOutOfBoundsException.class) public void testElementAtWithMinusIndexFlowable() { Flowable.fromArray(1, 2).elementAt(-1); }
@Override public Publisher<Integer> createPublisher(final long elements) { return Flowable.range(1, 10).elementAt(5).toFlowable() ; }
@Test public void testElementAt() { assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).blockingGet() .intValue()); }
@Test public void testElementAtOrDefault() { assertEquals(2, Flowable.fromArray(1, 2).elementAt(1, 0).blockingGet().intValue()); }
@Test public void testElementAtWithIndexOutOfBoundsFlowable() { assertEquals(-100, Flowable.fromArray(1, 2).elementAt(2).toFlowable().blockingFirst(-100).intValue()); }
@Test public void testElementAtFlowable() { assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle() .intValue()); }
@Test public void elementAtIndex0WithDefaultOnEmptySource() { Flowable.empty() .elementAt(0, 5) .test() .assertResult(5); }
@Test public void elementAtIndex1WithDefaultOnEmptySource() { Flowable.empty() .elementAt(1, 10) .test() .assertResult(10); }
@Test public void elementAtIndex0OnEmptySource() { Flowable.empty() .elementAt(0) .test() .assertResult(); }
@Test public void elementAtIndex1OnEmptySource() { Flowable.empty() .elementAt(1) .test() .assertResult(); }
@Test public void elementAtIndex1WithDefaultOnEmptySourceObservable() { Flowable.empty() .elementAt(1, 10) .toFlowable() .test() .assertResult(10); }
@Test public void errorFlowable() { Flowable.error(new TestException()) .elementAt(1, 10) .toFlowable() .test() .assertFailure(TestException.class); }