Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move unbound() shorthand to ScopeProvider itself #125

Merged
merged 5 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
*/
public interface ScopeProvider {

ScopeProvider UNBOUND = new ScopeProvider() {
@Override public Maybe<?> requestScope() {
return Maybe.empty();
}
};

/**
* @return a Maybe that, upon emission, will trigger disposal.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public static TestScopeProvider create(Maybe<?> delegate) {
* scope is unbound.
*
* @return the created TestScopeProvider
* @deprecated in favor of {@link ScopeProvider#UNBOUND}. This method will be removed in 1.0.
*/
@Deprecated
public static TestScopeProvider unbound() {
return create(Maybe.empty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public CompletableObserver apply(Completable source, CompletableObserver observe
}
});
Completable.complete()
.to(AutoDispose.with(Maybe.never())
.to(AutoDispose.with(ScopeProvider.UNBOUND)
.forCompletable())
.subscribe();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class AutoDisposeMaybeObserverTest {

@Test public void autoDispose_withSuperClassGenerics_compilesFine() {
Maybe.just(new BClass())
.to(AutoDispose.with(Maybe.never()).<AClass>forMaybe())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<AClass>forMaybe())
.subscribe(new Consumer<AClass>() {
@Override public void accept(AClass aClass) throws Exception {

Expand All @@ -84,7 +84,7 @@ public class AutoDisposeMaybeObserverTest {

@Test public void autoDispose_noGenericsOnEmpty_isFine() {
Maybe.just(new BClass())
.to(AutoDispose.with(Maybe.never())
.to(AutoDispose.with(ScopeProvider.UNBOUND)
.forMaybe())
.subscribe();
}
Expand Down Expand Up @@ -343,7 +343,7 @@ public class AutoDisposeMaybeObserverTest {
}
});
Maybe.just(1)
.to(AutoDispose.with(Maybe.never()).<Integer>forMaybe())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<Integer>forMaybe())
.subscribe();

assertThat(atomicAutoDisposingObserver.get()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class AutoDisposeObserverTest {

@Test public void autoDispose_withSuperClassGenerics_compilesFine() {
Observable.just(new BClass())
.to(AutoDispose.with(Maybe.never()).<AClass>forObservable())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<AClass>forObservable())
.subscribe(new Consumer<AClass>() {
@Override public void accept(AClass aClass) throws Exception {

Expand All @@ -87,7 +87,7 @@ public class AutoDisposeObserverTest {

@Test public void autoDispose_noGenericsOnEmpty_isFine() {
Observable.just(new BClass())
.to(AutoDispose.with(Maybe.never())
.to(AutoDispose.with(ScopeProvider.UNBOUND)
.forObservable())
.subscribe();
}
Expand Down Expand Up @@ -278,7 +278,7 @@ public class AutoDisposeObserverTest {
}
});
Observable.just(1)
.to(AutoDispose.with(Maybe.never()).<Integer>forObservable())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<Integer>forObservable())
.subscribe();

assertThat(atomicAutoDisposingObserver.get()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class AutoDisposeSingleObserverTest {

@Test public void autoDispose_withSuperClassGenerics_compilesFine() {
Single.just(new BClass())
.to(AutoDispose.with(Maybe.never()).<AClass>forSingle())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<AClass>forSingle())
.subscribe(new Consumer<AClass>() {
@Override public void accept(AClass aClass) throws Exception {

Expand All @@ -86,7 +86,7 @@ public class AutoDisposeSingleObserverTest {

@Test public void autoDispose_noGenericsOnEmpty_isFine() {
Single.just(new BClass())
.to(AutoDispose.with(Maybe.never())
.to(AutoDispose.with(ScopeProvider.UNBOUND)
.forSingle())
.subscribe();
}
Expand Down Expand Up @@ -314,7 +314,7 @@ public class AutoDisposeSingleObserverTest {
}
});
Single.just(1)
.to(AutoDispose.with(Maybe.never()).<Integer>forSingle())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<Integer>forSingle())
.subscribe();

assertThat(atomicAutoDisposingObserver.get()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class AutoDisposeSubscriberTest {

@Test public void autoDispose_withSuperClassGenerics_compilesFine() {
Flowable.just(new BClass())
.to(AutoDispose.with(Maybe.never()).<AClass>forFlowable())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<AClass>forFlowable())
.subscribe(new Consumer<AClass>() {
@Override public void accept(AClass aClass) throws Exception {

Expand All @@ -82,7 +82,7 @@ public class AutoDisposeSubscriberTest {

@Test public void autoDispose_noGenericsOnEmpty_isFine() {
Flowable.just(new BClass())
.to(AutoDispose.with(Maybe.never())
.to(AutoDispose.with(ScopeProvider.UNBOUND)
.forFlowable())
.subscribe();
}
Expand Down Expand Up @@ -289,7 +289,7 @@ public class AutoDisposeSubscriberTest {
}
});
Flowable.just(1)
.to(AutoDispose.with(Maybe.never()).<Integer>forFlowable())
.to(AutoDispose.with(ScopeProvider.UNBOUND).<Integer>forFlowable())
.subscribe();

assertThat(atomicAutoDisposingSubscriber.get()).isNotNull();
Expand Down