/**
 * Tests for {@link ByteArrayAssert#contains(Byte, Index)}.
 *
 * @author Alex Ruiz
 * @author Yvonne Wang
 */
public class ByteArrayAssert_contains_at_Index_Test {
  private final Index index = Index.atIndex(0);
  @Rule public ExpectedException thrown = none();
  private byte[] actual = {6, 8, 16, 18};
  private final byte value = 6;
  private ByteArrayAssert assertions;

  @Before
  public void setUp() {
    assertions = new ByteArrayAssert(actual);
  }

  @Test
  public void should_return_this() {
    ByteArrayAssert returned = assertions.contains(value, index);
    Assert.assertSame(returned, assertions);
  }

  @Test
  public void should_pass_if_actual_contains_value_at_index() {
    assertions.contains(value, index);
  }

  @Test
  public void should_fail_if_actual_does_not_contain_value_at_index() {
    thrown.expect(AssertionError.class);
    assertions.contains((byte) 8, index);
  }

  @Test
  public void should_throw_error_if_actual_is_null() {
    thrown.expect(AssertionError.class);
    actual = null;
    assertions = new ByteArrayAssert(actual);
    assertions.contains(value, index);
  }

  @Test
  public void should_throw_error_if_actual_is_empty() {
    thrown.expect(AssertionError.class);
    actual = new byte[0];
    assertions = new ByteArrayAssert(actual);
    assertions.contains(value, index);
  }

  @Test
  public void should_fail_if_index_is_null() {
    thrown.expect(NullPointerException.class);
    assertions.contains(value, null);
  }

  @Test
  public void should_fail_if_index_is_invalid() {
    thrown.expect(IllegalArgumentException.class);
    assertions.contains(value, Index.atIndex(-1));
  }
}
/**
 * Tests for {@link IntArrayAssert#doesNotContain(Integer, Index)}.
 *
 * @author Alex Ruiz
 * @author Yvonne Wang
 */
public class IntArrayAssert_doesNotContain_at_Index_Test {
  @Rule public ExpectedException thrown = none();
  private int[] actual = {1, 2, 3, 4, 5, 6};
  private Integer value = 3;
  private Index index = Index.atIndex(3);
  private IntArrayAssert assertions;

  @Before
  public void setUp() {
    assertions = new IntArrayAssert(actual);
  }

  @Test
  public void should_pass_if_actual_does_not_contain_given_value_at_given_index() {
    assertions.doesNotContain(value, index);
  }

  @Test
  public void should_return_this_if_actual_does_not_contain_given_value_at_given_index() {
    IntArrayAssert returned = assertions.doesNotContain(value, index);
    assertSame(returned, assertions);
  }

  @Test
  public void should_throw_error_if_actual_is_null() {
    thrown.expect(AssertionError.class);
    assertions = new IntArrayAssert(null);
    assertions.doesNotContain(value, index);
  }

  @Test
  public void should_throw_error_if_actual_is_empty() {
    thrown.expect(AssertionError.class);
    assertions = new IntArrayAssert(new int[0]);
    assertions.doesNotContain(value, index);
  }

  @Test
  public void should_throw_error_if_given_value_is_null() {
    thrown.expect(AssertionError.class);
    assertions.doesNotContain(null, index);
  }

  @Test
  public void should_throw_error_if_given_index_is_null() {
    thrown.expect(AssertionError.class);
    assertions.doesNotContain(value, null);
  }

  @Test
  public void should_fail_if_actual_contains_given_value_at_given_index() {
    thrown.expect(AssertionError.class);
    assertions.doesNotContain(4, index);
  }
}
/**
 * Tests for {@link FloatArrayAssert#doesNotContain(Float, org.fest.assertions.data.Index)}.
 *
 * @author Alex Ruiz
 * @author Yvonne Wang
 */
public class FloatArrayAssert_doesNotContain_at_Index_Test {
  @Rule public ExpectedException thrown = none();
  private final float[] actual = {1f, 2f, 3f, 4f, 5f, 6f};
  private final Float value = 3f;
  private final Index index = Index.atIndex(3);
  private FloatArrayAssert assertions;

  @Before
  public void setUp() {
    assertions = new FloatArrayAssert(actual);
  }

  @Test
  public void should_pass_if_actual_does_not_contain_given_value_at_given_index() {
    assertions.doesNotContain(value, index);
  }

  @Test
  public void should_return_this_if_actual_does_not_contain_given_value_at_given_index() {
    FloatArrayAssert returned = assertions.doesNotContain(value, index);
    assertSame(returned, assertions);
  }

  @Test
  public void should_throw_error_if_actual_is_null() {
    thrown.expect(AssertionError.class);
    assertions = new FloatArrayAssert(null);
    assertions.doesNotContain(value, index);
  }

  @Test
  public void should_pass_if_actual_is_empty() {
    assertions = new FloatArrayAssert(new float[0]);
    assertions.doesNotContain(value, index);
  }

  @Test
  public void should_throw_error_if_given_value_is_null() {
    thrown.expect(NullPointerException.class);
    assertions.doesNotContain(null, index);
  }

  @Test
  public void should_throw_error_if_given_index_is_null() {
    thrown.expect(NullPointerException.class);
    assertions.doesNotContain(value, null);
  }

  @Test
  public void should_fail_if_actual_contains_given_value_at_given_index() {
    thrown.expect(AssertionError.class);
    assertions.doesNotContain(4f, index);
  }
}
 @Test
 public void should_not_be_equal_to_Index_with_different_value() {
   assertFalse(index.equals(atIndex(6)));
 }
 @Test
 public void should_not_be_equal_to_null() {
   assertFalse(index.equals(null));
 }
 @Test
 public void should_not_be_equal_to_Object_of_different_type() {
   assertFalse(index.equals("8"));
 }
 /**
  * Only delegate to {@link Index#atIndex(int)} so that Assertions offers a full feature entry
  * point to all Fest Assert features (but you can use {@link Index} if you prefer).
  *
  * <p>Typical usage :
  *
  * <pre>
  * List<Ring> elvesRings = newArrayList(vilya, nenya, narya);
  * assertThat(elvesRings).contains(vilya, atIndex(0)).contains(nenya, atIndex(1)).contains(narya, atIndex(2));
  * </pre>
  */
 public static Index atIndex(int index) {
   return Index.atIndex(index);
 }
 @Test
 public void should_fail_if_index_is_invalid() {
   thrown.expect(IllegalArgumentException.class);
   assertions.contains(value, Index.atIndex(-1));
 }