[SPARK-12376][TESTS] Spark Streaming Java8APISuite fails in assertOrderInvariantEquals method

org.apache.spark.streaming.Java8APISuite.java is failing due to trying to sort immutable list in assertOrderInvariantEquals method.

Author: Evan Chen <chene@us.ibm.com>

Closes #10336 from evanyc15/SPARK-12376-StreamingJavaAPISuite.
This commit is contained in:
Evan Chen 2015-12-17 14:22:30 -08:00 committed by Shixiong Zhu
parent e096a652b9
commit ed6ebda5c8

View file

@ -439,9 +439,14 @@ public class Java8APISuite extends LocalJavaStreamingContext implements Serializ
*/
public static <T extends Comparable<T>> void assertOrderInvariantEquals(
List<List<T>> expected, List<List<T>> actual) {
expected.forEach((List<T> list) -> Collections.sort(list));
actual.forEach((List<T> list) -> Collections.sort(list));
Assert.assertEquals(expected, actual);
expected.forEach(list -> Collections.sort(list));
List<List<T>> sortedActual = new ArrayList<>();
actual.forEach(list -> {
List<T> sortedList = new ArrayList<>(list);
Collections.sort(sortedList);
sortedActual.add(sortedList);
});
Assert.assertEquals(expected, sortedActual);
}
@Test