Skip to content

Commit

Permalink
Vararg change unit tests in Groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
benjchristensen committed Sep 10, 2013
1 parent 5957881 commit af31156
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,30 @@ def class ObservableTests {
verify(a, times(1)).received("hello_2");
}

@Test
public void testFromWithIterable() {
def list = [1, 2, 3, 4, 5]
assertEquals(5, Observable.from(list).count().toBlockingObservable().single());
}

@Test
public void testFromWithObjects() {
def list = [1, 2, 3, 4, 5]
// this should now treat these as 2 objects so have a count of 2
assertEquals(2, Observable.from(list, 6).count().toBlockingObservable().single());
}

/**
* Check that two different single arg methods are selected correctly
*/
@Test
public void testStartWith() {
def list = [10, 11, 12, 13, 14]
def startList = [1, 2, 3, 4, 5]
assertEquals(6, Observable.from(list).startWith(0).count().toBlockingObservable().single());
assertEquals(10, Observable.from(list).startWith(startList).count().toBlockingObservable().single());
}

@Test
public void testScriptWithOnNext() {
new TestFactory().getObservable().subscribe({ result -> a.received(result)});
Expand Down

0 comments on commit af31156

Please sign in to comment.