Skip to content

Commit

Permalink
Opportunistic formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Aug 31, 2017
1 parent 1d4e626 commit 43d8da2
Showing 1 changed file with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,14 @@ public class AutoDisposeSubscriberTest {

@Test public void autoDispose_withProviderAndNoOpPlugin_withoutStarting_shouldFailSilently() {
AutoDisposePlugins.setOutsideLifecycleHandler(new Consumer<OutsideLifecycleException>() {
@Override
public void accept(OutsideLifecycleException e) throws Exception { }
@Override public void accept(OutsideLifecycleException e) throws Exception { }
});
BehaviorSubject<Integer> lifecycle = BehaviorSubject.create();
TestSubscriber<Integer> o = new TestSubscriber<>();
LifecycleScopeProvider<Integer> provider = TestUtil.makeLifecycleProvider(lifecycle);
PublishProcessor<Integer> source = PublishProcessor.create();
source
.to(new FlowableScoper<Integer>(provider))
.subscribe(o);
source.to(new FlowableScoper<Integer>(provider))
.subscribe(o);

assertThat(source.hasSubscribers()).isFalse();
assertThat(lifecycle.hasObservers()).isFalse();
Expand All @@ -221,8 +219,7 @@ public void accept(OutsideLifecycleException e) throws Exception { }

@Test public void autoDispose_withProviderAndNoOpPlugin_afterEnding_shouldFailSilently() {
AutoDisposePlugins.setOutsideLifecycleHandler(new Consumer<OutsideLifecycleException>() {
@Override
public void accept(OutsideLifecycleException e) throws Exception {
@Override public void accept(OutsideLifecycleException e) throws Exception {
// Noop
}
});
Expand All @@ -233,9 +230,8 @@ public void accept(OutsideLifecycleException e) throws Exception {
TestSubscriber<Integer> o = new TestSubscriber<>();
LifecycleScopeProvider<Integer> provider = TestUtil.makeLifecycleProvider(lifecycle);
PublishProcessor<Integer> source = PublishProcessor.create();
source
.to(new FlowableScoper<Integer>(provider))
.subscribe(o);
source.to(new FlowableScoper<Integer>(provider))
.subscribe(o);

assertThat(source.hasSubscribers()).isFalse();
assertThat(lifecycle.hasObservers()).isFalse();
Expand All @@ -245,8 +241,7 @@ public void accept(OutsideLifecycleException e) throws Exception {

@Test public void autoDispose_withProviderAndPlugin_withoutStarting_shouldFailWithExp() {
AutoDisposePlugins.setOutsideLifecycleHandler(new Consumer<OutsideLifecycleException>() {
@Override
public void accept(OutsideLifecycleException e) throws Exception {
@Override public void accept(OutsideLifecycleException e) throws Exception {
// Wrap in an IllegalStateException so we can verify this is the exception we see on the
// other side
throw new IllegalStateException(e);
Expand All @@ -256,16 +251,14 @@ public void accept(OutsideLifecycleException e) throws Exception {
TestSubscriber<Integer> o = new TestSubscriber<>();
LifecycleScopeProvider<Integer> provider = TestUtil.makeLifecycleProvider(lifecycle);
PublishProcessor<Integer> source = PublishProcessor.create();
source
.to(new FlowableScoper<Integer>(provider))
.subscribe(o);
source.to(new FlowableScoper<Integer>(provider))
.subscribe(o);

o.assertNoValues();
o.assertError(new Predicate<Throwable>() {
@Override
public boolean test(Throwable throwable) throws Exception {
@Override public boolean test(Throwable throwable) throws Exception {
return throwable instanceof IllegalStateException
&& throwable.getCause() instanceof OutsideLifecycleException;
&& throwable.getCause() instanceof OutsideLifecycleException;
}
});
}
Expand Down

0 comments on commit 43d8da2

Please sign in to comment.