Search in sources :

Example 26 with Index

use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.

the class BooleanArrays_assertDoesNotContain_at_Index_Test method should_fail_if_actual_contains_value_at_index.

@Test
public void should_fail_if_actual_contains_value_at_index() {
    AssertionInfo info = someInfo();
    boolean value = true;
    Index index = atIndex(0);
    try {
        arrays.assertDoesNotContain(info, actual, value, index);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContainAtIndex(actual, value, index));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) TestData.someIndex(org.assertj.core.test.TestData.someIndex) ShouldNotContainAtIndex.shouldNotContainAtIndex(org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) Index(org.assertj.core.data.Index) Test(org.junit.Test) BooleanArraysBaseTest(org.assertj.core.internal.BooleanArraysBaseTest)

Example 27 with Index

use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.

the class ObjectArrays_assertContains_at_Index_Test method should_fail_if_actual_does_not_contain_value_at_index_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_does_not_contain_value_at_index_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    Index index = atIndex(1);
    try {
        arraysWithCustomComparisonStrategy.assertContains(info, actual, "Han", index);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldContainAtIndex(actual, "Han", index, "Luke", caseInsensitiveStringComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Index.atIndex(org.assertj.core.data.Index.atIndex) Index(org.assertj.core.data.Index) ShouldContainAtIndex.shouldContainAtIndex(org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex) Test(org.junit.Test) ObjectArraysBaseTest(org.assertj.core.internal.ObjectArraysBaseTest)

Example 28 with Index

use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.

the class ObjectArrays_assertDoesNotContain_at_Index_Test method should_fail_if_actual_contains_value_at_index.

@Test
public void should_fail_if_actual_contains_value_at_index() {
    AssertionInfo info = someInfo();
    Index index = atIndex(0);
    try {
        arrays.assertDoesNotContain(info, actual, "Yoda", index);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContainAtIndex(actual, "Yoda", index));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) ShouldNotContainAtIndex.shouldNotContainAtIndex(org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) Index(org.assertj.core.data.Index) Test(org.junit.Test) ObjectArraysBaseTest(org.assertj.core.internal.ObjectArraysBaseTest)

Example 29 with Index

use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.

the class DoubleArrays_assertContains_at_Index_Test method should_fail_if_actual_does_not_contain_value_at_index.

@Test
public void should_fail_if_actual_does_not_contain_value_at_index() {
    double value = 6;
    Index index = atIndex(1);
    thrown.expectAssertionError(shouldContainAtIndex(actual, value, index, 8d));
    arrays.assertContains(someInfo(), actual, value, index);
}
Also used : TestData.someIndex(org.assertj.core.test.TestData.someIndex) Index(org.assertj.core.data.Index) ShouldContainAtIndex.shouldContainAtIndex(org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) Test(org.junit.Test) DoubleArraysBaseTest(org.assertj.core.internal.DoubleArraysBaseTest)

Example 30 with Index

use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.

the class DoubleArrays_assertContains_at_Index_Test method should_fail_if_actual_does_not_contain_value_at_index_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_does_not_contain_value_at_index_according_to_custom_comparison_strategy() {
    double value = 6;
    Index index = atIndex(1);
    thrown.expectAssertionError(shouldContainAtIndex(actual, value, index, 8d, absValueComparisonStrategy));
    arraysWithCustomComparisonStrategy.assertContains(someInfo(), actual, value, index);
}
Also used : TestData.someIndex(org.assertj.core.test.TestData.someIndex) Index(org.assertj.core.data.Index) ShouldContainAtIndex.shouldContainAtIndex(org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) Test(org.junit.Test) DoubleArraysBaseTest(org.assertj.core.internal.DoubleArraysBaseTest)

Aggregations

Index (org.assertj.core.data.Index)45 Index.atIndex (org.assertj.core.data.Index.atIndex)44 Test (org.junit.Test)44 AssertionInfo (org.assertj.core.api.AssertionInfo)40 ShouldContainAtIndex.shouldContainAtIndex (org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex)21 ShouldNotContainAtIndex.shouldNotContainAtIndex (org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex)21 TestData.someIndex (org.assertj.core.test.TestData.someIndex)12 ByteArraysBaseTest (org.assertj.core.internal.ByteArraysBaseTest)8 ListsBaseTest (org.assertj.core.internal.ListsBaseTest)6 CharArraysBaseTest (org.assertj.core.internal.CharArraysBaseTest)4 DoubleArraysBaseTest (org.assertj.core.internal.DoubleArraysBaseTest)4 FloatArraysBaseTest (org.assertj.core.internal.FloatArraysBaseTest)4 IntArraysBaseTest (org.assertj.core.internal.IntArraysBaseTest)4 LongArraysBaseTest (org.assertj.core.internal.LongArraysBaseTest)4 ObjectArraysBaseTest (org.assertj.core.internal.ObjectArraysBaseTest)4 ShortArraysBaseTest (org.assertj.core.internal.ShortArraysBaseTest)4 BooleanArraysBaseTest (org.assertj.core.internal.BooleanArraysBaseTest)2 ShouldBeAtIndex.shouldBeAtIndex (org.assertj.core.error.ShouldBeAtIndex.shouldBeAtIndex)1 ShouldHaveAtIndex.shouldHaveAtIndex (org.assertj.core.error.ShouldHaveAtIndex.shouldHaveAtIndex)1