Skip to content

Commit

Permalink
Update tests and flip implementation logic to match naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Sep 10, 2017
1 parent bae194c commit 500df33
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ public boolean isDisposed() {

@Override
public boolean hasCustomOnError() {
return onError == this;
return onError != this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ public boolean isDisposed() {

@Override
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
return onError != Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public void onSubscribe(Disposable d) {

@Override
public boolean hasCustomOnError() {
return true;
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ public boolean isDisposed() {

@Override
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
return onError != Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ public void onComplete() {

@Override
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
return onError != Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ public void cancel() {

@Override
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
return onError != Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
public final class CallbackCompletableObserverTest {

@Test
public void hasMissingErrorConsumer() {
public void emptyActionShouldReportNoCustomOnError() {
CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.EMPTY_ACTION);

assertTrue(o.hasCustomOnError());
assertFalse(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
public void customOnErrorShouldReportCustomOnError() {
CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION);

assertFalse(o.hasCustomOnError());
assertTrue(o.hasCustomOnError());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
public final class ConsumerSingleObserverTest {

@Test
public void hasMissingErrorConsumer() {
public void onErrorMissingShouldReportNoCustomOnError() {
ConsumerSingleObserver<Integer> o = new ConsumerSingleObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.ON_ERROR_MISSING);

assertTrue(o.hasCustomOnError());
assertFalse(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
public void customOnErrorShouldReportCustomOnError() {
ConsumerSingleObserver<Integer> o = new ConsumerSingleObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer());

assertFalse(o.hasCustomOnError());
assertTrue(o.hasCustomOnError());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import org.junit.Test;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

public final class EmptyCompletableObserverTest {

@Test
public void hasMissingErrorConsumer() {
public void defaultShouldReportNoCustomOnError() {
EmptyCompletableObserver o = new EmptyCompletableObserver();

assertTrue(o.hasCustomOnError());
assertFalse(o.hasCustomOnError());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -345,22 +345,22 @@ public void accept(Disposable s) throws Exception {
}

@Test
public void hasMissingErrorConsumer() {
public void onErrorMissingShouldReportNoCustomOnError() {
LambdaObserver<Integer> o = new LambdaObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION,
Functions.<Disposable>emptyConsumer());

assertTrue(o.hasCustomOnError());
assertFalse(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
public void customOnErrorShouldReportCustomOnError() {
LambdaObserver<Integer> o = new LambdaObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION,
Functions.<Disposable>emptyConsumer());

assertFalse(o.hasCustomOnError());
assertTrue(o.hasCustomOnError());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,20 @@ public void run() throws Exception {
}

@Test
public void hasMissingErrorConsumer() {
public void onErrorMissingShouldReportNoCustomOnError() {
MaybeCallbackObserver<Integer> o = new MaybeCallbackObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION);

assertTrue(o.hasCustomOnError());
assertFalse(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
public void customOnErrorShouldReportCustomOnError() {
MaybeCallbackObserver<Integer> o = new MaybeCallbackObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION);

assertFalse(o.hasCustomOnError());
assertTrue(o.hasCustomOnError());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -350,22 +350,22 @@ public void accept(Subscription s) throws Exception {
}

@Test
public void hasMissingErrorConsumer() {
public void onErrorMissingShouldReportNoCustomOnError() {
LambdaSubscriber<Integer> o = new LambdaSubscriber<Integer>(Functions.<Integer>emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION,
FlowableInternalHelper.RequestMax.INSTANCE);

assertTrue(o.hasCustomOnError());
assertFalse(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
public void customOnErrorShouldReportCustomOnError() {
LambdaSubscriber<Integer> o = new LambdaSubscriber<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION,
FlowableInternalHelper.RequestMax.INSTANCE);

assertFalse(o.hasCustomOnError());
assertTrue(o.hasCustomOnError());
}
}

0 comments on commit 500df33

Please sign in to comment.