001 /*
002 * Created on Nov 24, 2010
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
005 * the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
010 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
011 * specific language governing permissions and limitations under the License.
012 *
013 * Copyright @2010-2011 the original author or authors.
014 */
015 package org.fest.assertions.core;
016
017 import org.fest.assertions.data.Index;
018
019 /**
020 * Assertions methods applicable to indexed groups of objects (e.g. arrays or lists.)
021 * @param <S> the "self" type of this assertion class. Please read "<a href="http://bit.ly/anMa4g"
022 * target="_blank">Emulating 'self types' using Java Generics to simplify fluent API implementation</a>"
023 * for more details.
024 * @param <T> the type of elements of the "actual" value.
025 *
026 * @author Alex Ruiz
027 * @author Mikhail Mazursky
028 */
029 public interface IndexedObjectEnumerableAssert<S extends IndexedObjectEnumerableAssert<S, T>, T> extends ObjectEnumerableAssert<S, T> {
030
031 /**
032 * Verifies that the actual group contains the given object at the given index.
033 * @param value the object to look for.
034 * @param index the index where the object should be stored in the actual group.
035 * @return this assertion object.
036 * @throws AssertionError if the actual group is {@code null} or empty.
037 * @throws NullPointerException if the given {@code Index} is {@code null}.
038 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of
039 * the actual group.
040 * @throws AssertionError if the actual group does not contain the given object at the given index.
041 */
042 S contains(T value, Index index);
043
044 /**
045 * Verifies that the actual group does not contain the given object at the given index.
046 * @param value the object to look for.
047 * @param index the index where the object should be stored in the actual group.
048 * @return this assertion object.
049 * @throws AssertionError if the actual group is {@code null}.
050 * @throws NullPointerException if the given {@code Index} is {@code null}.
051 * @throws AssertionError if the actual group contains the given object at the given index.
052 */
053 S doesNotContain(T value, Index index);
054 }