truth
truth copied to clipboard
Truth inorder not fully documented
https://truth.dev/api/0.46/com/google/common/truth/Ordered.html
This does not indicate whether intervening elements are or are not allowed. E.g. does
assertThat(list).containsAllElementsIn("a", "b", "c").inOrder();
pass or fail if list in fact contains:
"a", "z", "b", "c"
The API docs should be explicit on this point.
This is documented on the methods that return Ordered
. For example:
https://truth.dev/api/0.46/com/google/common/truth/IterableSubject.html#containsAtLeastElementsIn-java.lang.Iterable-
"To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method. The expected elements must appear in the given order within the actual elements, but they are not required to be consecutive."
But I agree that we can make this clearer. Thanks.
That is clear. It just isn't where I naturally looked. It didn't occur to me to look for that information on the API doc for containsElementsIn
instead of inOrder
.