Skip to content

Commit 3ff761e

Browse files
author
jmhofer
committed
added test against long sum, too (#83)
1 parent 849d7fe commit 3ff761e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

rxjava-core/src/main/java/rx/operators/OperationSum.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,28 @@ public void testEmptySum() throws Throwable {
9595
verify(w, times(1)).onCompleted();
9696
}
9797

98+
@Test
99+
public void testSumOfAFewLongs() throws Throwable {
100+
Observable<Long> src = Observable.from(1L, 2L, 3L, 4L, 5L);
101+
sumLongs(src).subscribe(wl);
102+
103+
verify(wl, times(1)).onNext(anyLong());
104+
verify(wl).onNext(15L);
105+
verify(wl, never()).onError(any(Throwable.class));
106+
verify(wl, times(1)).onCompleted();
107+
}
108+
109+
@Test
110+
public void testEmptySumLongs() throws Throwable {
111+
Observable<Long> src = Observable.from();
112+
sumLongs(src).subscribe(wl);
113+
114+
verify(wl, times(1)).onNext(anyLong());
115+
verify(wl).onNext(0L);
116+
verify(wl, never()).onError(any(Throwable.class));
117+
verify(wl, times(1)).onCompleted();
118+
}
119+
98120
@Test
99121
public void testSumOfAFewFloats() throws Throwable {
100122
Observable<Float> src = Observable.from(1.0f);

0 commit comments

Comments
 (0)