forked from ReactiveX/RxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartWithTests.java
More file actions
33 lines (24 loc) · 870 Bytes
/
StartWithTests.java
File metadata and controls
33 lines (24 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package rx;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
public class StartWithTests {
@Test
public void startWith1() {
List<String> values = Observable.from("one", "two").startWith("zero").toList().toBlockingObservable().single();
assertEquals("zero", values.get(0));
assertEquals("two", values.get(2));
}
@Test
public void startWithIterable() {
List<String> li = new ArrayList<String>();
li.add("alpha");
li.add("beta");
List<String> values = Observable.from("one", "two").startWith(li).toList().toBlockingObservable().single();
assertEquals("alpha", values.get(0));
assertEquals("beta", values.get(1));
assertEquals("one", values.get(2));
assertEquals("two", values.get(3));
}
}