For IntelliJ IDEA,
Android Studio or Eclipse



/** * Verifies that the actual <code>{@link List}</code> ends with the given sequence of objects, without any other * objects between them. Same as <code>{@link #containsSequence}</code>, but verifies also that last given object is * also last element of {@code List}. * @param sequence the sequence of objects to look for. * @return this assertion object. * @throws AssertionError if the actual {@code List} is {@code null}. * @throws AssertionError if the given array is {@code null}. * @throws AssertionError if the actual {@code List} is not empty and with the given sequence of objects is * empty. * @throws AssertionError if the actual {@code List} does not end with the given sequence of objects. */ public ListAssert endsWith(Object... sequence) { isNotNull(); validateIsNotNull(sequence); int sequenceSize = sequence.length; int listSize = actualGroupSize(); if (sequenceSize == 0 && listSize == 0) return this; if (sequenceSize == 0 && listSize != 0) failIfNotEndingWithSequence(sequence); if (listSize < sequenceSize) failIfNotEndingWithSequence(sequence); for (int i = 0; i < sequenceSize; i++) { int sequenceIndex = sequenceSize - 1 - i; int listIndex = listSize - 1 - i; if (!areEqual(sequence[sequenceIndex], actual.get(listIndex))) failIfNotEndingWithSequence(sequence); } return this; }