forked from ReactiveX/RxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Observable.startWith: refactor varargs to overloads
ReactiveX#359 Varargs cause compiler warnings
- Loading branch information
1 parent
665f80a
commit 574efe5
Showing
2 changed files
with
242 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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)); | ||
} | ||
|
||
} |