Skip to content

Commit 677f84c

Browse files
update completeness test
1 parent c66b2eb commit 677f84c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ class CompletenessTest extends JUnitSuite {
2222
"You can use `fold` instead to accumulate `sum` and `numberOfElements` and divide at the end.]"
2323

2424
val commentForFirstWithPredicate = "[use `.filter(condition).first`]"
25+
26+
val fromFuture = "[TODO: Decide how Scala Futures should relate to Observables. Should there be a " +
27+
"common base interface for Future and Observable? And should Futures also have an unsubscribe method?]"
2528

2629
val correspondence = defaultMethodCorrespondence ++ Map(
2730
// manually added entries for Java instance methods
2831
"aggregate(Func2[T, T, T])" -> "reduce((U, U) => U)",
29-
"aggregate(R, Func2[R, _ >: T, R])" -> "fold(R)((R, T) => R)",
32+
"aggregate(R, Func2[R, _ >: T, R])" -> "foldLeft(R)((R, T) => R)",
3033
"all(Func1[_ >: T, Boolean])" -> "forall(T => Boolean)",
3134
"buffer(Long, Long, TimeUnit)" -> "buffer(Duration, Duration)",
3235
"buffer(Long, Long, TimeUnit, Scheduler)" -> "buffer(Duration, Duration, Scheduler)",
@@ -47,7 +50,7 @@ class CompletenessTest extends JUnitSuite {
4750
"parallel(Func1[Observable[T], Observable[R]])" -> "parallel(Observable[T] => Observable[R])",
4851
"parallel(Func1[Observable[T], Observable[R]], Scheduler)" -> "parallel(Observable[T] => Observable[R], Scheduler)",
4952
"reduce(Func2[T, T, T])" -> "reduce((U, U) => U)",
50-
"reduce(R, Func2[R, _ >: T, R])" -> "fold(R)((R, T) => R)",
53+
"reduce(R, Func2[R, _ >: T, R])" -> "foldLeft(R)((R, T) => R)",
5154
"scan(Func2[T, T, T])" -> unnecessary,
5255
"scan(R, Func2[R, _ >: T, R])" -> "scan(R)((R, T) => R)",
5356
"skip(Int)" -> "drop(Int)",
@@ -57,6 +60,7 @@ class CompletenessTest extends JUnitSuite {
5760
"takeFirst()" -> "first",
5861
"takeFirst(Func1[_ >: T, Boolean])" -> commentForFirstWithPredicate,
5962
"takeLast(Int)" -> "takeRight(Int)",
63+
"takeWhileWithIndex(Func2[_ >: T, _ >: Integer, Boolean])" -> "[use `.zipWithIndex.takeWhile{case (elem, index) => condition}.map(_._1)`]",
6064
"toList()" -> "toSeq",
6165
"toSortedList()" -> "[Sorting is already done in Scala's collection library, use `.toSeq.map(_.sorted)`]",
6266
"toSortedList(Func2[_ >: T, _ >: T, Integer])" -> "[Sorting is already done in Scala's collection library, use `.toSeq.map(_.sortWith(f))`]",
@@ -77,9 +81,10 @@ class CompletenessTest extends JUnitSuite {
7781
"error(Throwable)" -> "apply(Throwable)",
7882
"from(Array[T])" -> "apply(T*)",
7983
"from(Iterable[_ <: T])" -> "apply(T*)",
80-
"from(Future[_ <: T])" -> "apply(Future[T])",
81-
"from(Future[_ <: T], Long, TimeUnit)" -> "apply(Future[T], Duration)",
82-
"from(Future[_ <: T], Scheduler)" -> "apply(Future[T], Scheduler)",
84+
"from(Future[_ <: T])" -> fromFuture,
85+
"from(Future[_ <: T], Long, TimeUnit)" -> fromFuture,
86+
"from(Future[_ <: T], Scheduler)" -> fromFuture,
87+
"just(T)" -> "apply(T*)",
8388
"merge(Observable[_ <: T], Observable[_ <: T])" -> "merge(Observable[U])",
8489
"merge(Observable[_ <: Observable[_ <: T]])" -> "flatten(<:<[Observable[T], Observable[Observable[U]]])",
8590
"mergeDelayError(Observable[_ <: T], Observable[_ <: T])" -> "mergeDelayError(Observable[U])",
@@ -298,7 +303,7 @@ class CompletenessTest extends JUnitSuite {
298303
(if (p._1.startsWith("average")) "average" else p._1.takeWhile(_ != '('), p._2)
299304
def formatJavaCol(name: String, alternatives: Iterable[String]): String = {
300305
alternatives.toList.sorted.map(scalaToJavaSignature(_)).map(s => {
301-
if (s.length > 50) {
306+
if (s.length > 64) {
302307
val toolTip = escapeJava(s)
303308
"<span title=\"" + toolTip + "\"><code>" + name + "(...)</code></span>"
304309
} else {

0 commit comments

Comments
 (0)