@Test public void testCollectorFailureDoesNotResultInTwoErrorEmissionsFlowable() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaCommonPlugins.setErrorHandler(addToList(list)); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); Burst.items(1).error(e2) // .collect(callableListCreator(), biConsumerThrows(e1)) .test() // .assertError(e1) // .assertNotComplete(); assertEquals(1, list.size()); assertEquals(e2, list.get(0).getCause()); } finally { RxJavaCommonPlugins.reset(); } }
@Test public void testCollectorFailureDoesNotResultInErrorAndCompletedEmissionsFlowable() { final RuntimeException e = new RuntimeException(); Burst.item(1).create() // .collect(callableListCreator(), biConsumerThrows(e)) // .test() // .assertError(e) // .assertNotComplete(); }
@Test public void testCollectorFailureDoesNotResultInErrorAndOnNextEmissions() { final RuntimeException e = new RuntimeException(); final AtomicBoolean added = new AtomicBoolean(); BiConsumer<Object, Integer> throwOnFirstOnly = new BiConsumer<Object, Integer>() { boolean once = true; @Override public void accept(Object o, Integer t) { if (once) { once = false; throw e; } else { added.set(true); } } }; Burst.items(1, 2).create() // .collect(callableListCreator(), throwOnFirstOnly)// .test() // .assertError(e) // .assertNoValues() // .assertNotComplete(); assertFalse(added.get()); }
@Test public void testCollectorFailureDoesNotResultInErrorAndCompletedEmissions() { final RuntimeException e = new RuntimeException(); Burst.item(1).create() // .collect(callableListCreator(), biConsumerThrows(e)) // .test() // .assertError(e) // .assertNotComplete(); }
@Test public void testCollectorFailureDoesNotResultInErrorAndOnNextEmissionsObservable() { final RuntimeException e = new RuntimeException(); final AtomicBoolean added = new AtomicBoolean(); BiConsumer<Object, Integer> throwOnFirstOnly = new BiConsumer<Object, Integer>() { boolean once = true; @Override public void accept(Object o, Integer t) { if (once) { once = false; throw e; } else { added.set(true); } } }; Burst.items(1, 2).create() // .collect(callableListCreator(), throwOnFirstOnly)// .test() // .assertError(e) // .assertNoValues() // .assertNotComplete(); assertFalse(added.get()); }
@Test public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaCommonPlugins.setErrorHandler(addToList(list)); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); Burst.items(1).error(e2) // .collect(callableListCreator(), biConsumerThrows(e1)) // .test() // .assertError(e1) // .assertNotComplete(); assertEquals(1, list.size()); assertEquals(e2, list.get(0).getCause()); } finally { RxJavaCommonPlugins.reset(); } }
@Test public void testCollectorFailureDoesNotResultInErrorAndCompletedEmissions() { final RuntimeException e = new RuntimeException(); Burst.item(1).create() // .collect(callableListCreator(), biConsumerThrows(e)) // .test() // .assertError(e) // .assertNotComplete(); }
@Test public void testCollectorFailureDoesNotResultInErrorAndOnNextEmissions() { final RuntimeException e = new RuntimeException(); final AtomicBoolean added = new AtomicBoolean(); BiConsumer<Object, Integer> throwOnFirstOnly = new BiConsumer<Object, Integer>() { boolean once = true; @Override public void accept(Object o, Integer t) { if (once) { once = false; throw e; } else { added.set(true); } } }; Burst.items(1, 2).create() // .collect(callableListCreator(), throwOnFirstOnly)// .test() // .assertError(e) // .assertNoValues() // .assertNotComplete(); assertFalse(added.get()); }
@Test public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaCommonPlugins.setErrorHandler(addToList(list)); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); Burst.items(1).error(e2) // .collect(callableListCreator(), biConsumerThrows(e1)) // .test() // .assertError(e1) // .assertNotComplete(); assertEquals(1, list.size()); assertEquals(e2, list.get(0).getCause()); } finally { RxJavaCommonPlugins.reset(); } }
@Test public void testCollectorFailureDoesNotResultInErrorAndCompletedEmissionsObservable() { final RuntimeException e = new RuntimeException(); Burst.item(1).create() // .collect(callableListCreator(), biConsumerThrows(e)) // .toObservable() .test() // .assertError(e) // .assertNotComplete(); }
@Test public void testCollectorFailureDoesNotResultInErrorAndOnNextEmissionsFlowable() { final RuntimeException e = new RuntimeException(); final AtomicBoolean added = new AtomicBoolean(); BiConsumer<Object, Integer> throwOnFirstOnly = new BiConsumer<Object, Integer>() { boolean once = true; @Override public void accept(Object o, Integer t) { if (once) { once = false; throw e; } else { added.set(true); } } }; Burst.items(1, 2).create() // .collect(callableListCreator(), throwOnFirstOnly)// .test() // .assertError(e) // .assertNoValues() // .assertNotComplete(); assertFalse(added.get()); }
@Test public void testCollectorFailureDoesNotResultInTwoErrorEmissionsObservable() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaCommonPlugins.setErrorHandler(addToList(list)); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); Burst.items(1).error(e2) // .collect(callableListCreator(), biConsumerThrows(e1)) // .toObservable() .test() // .assertError(e1) // .assertNotComplete(); assertEquals(1, list.size()); assertEquals(e2, list.get(0).getCause()); } finally { RxJavaCommonPlugins.reset(); } }