Skip to content

Commit 34dce48

Browse files
committed
Merge pull request #2999 from zsxwing/assert-error
Fix a wrong assertion in assertError
2 parents 53a0204 + a90788c commit 34dce48

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/rx/observers/TestSubscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public void assertError(Throwable throwable) {
380380
if (err.size() > 1) {
381381
throw new AssertionError("Multiple errors: " + err.size(), new CompositeException(err));
382382
} else
383-
if (throwable.equals(err.get(0))) {
383+
if (!throwable.equals(err.get(0))) {
384384
throw new AssertionError("Exceptions differ; expected: " + throwable + ", actual: " + err.get(0), err.get(0));
385385
}
386386
}

src/test/java/rx/observers/TestSubscriberTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,11 @@ public void testWrappingMockWhenUnsubscribeInvolved() {
121121
inOrder.verifyNoMoreInteractions();
122122
}
123123

124+
@Test
125+
public void testAssertError() {
126+
RuntimeException e = new RuntimeException("Oops");
127+
TestSubscriber subscriber = new TestSubscriber();
128+
Observable.error(e).subscribe(subscriber);
129+
subscriber.assertError(e);
130+
}
124131
}

0 commit comments

Comments
 (0)