Java6Assertions is calling a Java 8 Streams method
We hit this stack trace on our Android test:
java.lang.NoSuchMethodError: No interface method stream()Ljava/util/stream/Stream; in class Ljava/util/Collection; or its super classes (declaration of 'java.util.Collection' appears in /system/framework/core-libart.jar)
at org.assertj.core.util.Streams.stream(Streams.java:32)
at org.assertj.core.util.Lists.newArrayList(Lists.java:63)
at org.assertj.core.internal.Iterables.assertContainsExactlyInAnyOrder(Iterables.java:1164)
at org.assertj.core.api.AbstractIterableAssert.containsExactlyInAnyOrder(AbstractIterableAssert.java:285)
at org.assertj.core.api.ListAssert.containsExactlyInAnyOrder(ListAssert.java:277)
at org.assertj.core.api.ListAssert.containsExactlyInAnyOrder(ListAssert.java:49)
at com.example.SomeTest_someTestMethod(SomeTest.java:79)
You can see that Streams got added to Android in API 24, so our tests are crashing on earlier versions.
https://developer.android.com/reference/java/util/stream/Stream
We are using the correct Java6 import in our test:
import static org.assertj.core.api.Java6Assertions.assertThat;
@Test
public void someTestMethod() {
...
assertThat(actualIds).containsExactlyInAnyOrder(ID_1, ID_2);
}
I don't fully understand how the Java6Assertions package accomplishes it's task, but one of the subsequent calls is not calling purely Java-6 code.