Search in sources :

Example 36 with Index

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

the class FloatArrays_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() {
    float value = 6f;
    AssertionInfo info = someInfo();
    Index index = atIndex(1);
    try {
        arraysWithCustomComparisonStrategy.assertContains(info, actual, value, index);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldContainAtIndex(actual, value, index, 8f, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) 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) FloatArraysBaseTest(org.assertj.core.internal.FloatArraysBaseTest)

Example 37 with Index

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

the class FloatArrays_assertDoesNotContain_at_Index_Test method should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    Index index = atIndex(0);
    try {
        arraysWithCustomComparisonStrategy.assertDoesNotContain(info, actual, 6f, index);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContainAtIndex(actual, 6f, index, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Index(org.assertj.core.data.Index) ShouldNotContainAtIndex.shouldNotContainAtIndex(org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) Test(org.junit.Test) FloatArraysBaseTest(org.assertj.core.internal.FloatArraysBaseTest)

Example 38 with Index

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

the class ByteArrays_assertContains_at_Index_with_Integer_Argument_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() {
    AssertionInfo info = someInfo();
    Index index = atIndex(1);
    try {
        arrays.assertContains(info, actual, 6, index);
    } catch (AssertionError e) {
        byte found = 8;
        verify(failures).failure(info, shouldContainAtIndex(actual, (byte) 6, index, found));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Index(org.assertj.core.data.Index) ShouldContainAtIndex.shouldContainAtIndex(org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) ByteArraysBaseTest(org.assertj.core.internal.ByteArraysBaseTest) Test(org.junit.Test)

Example 39 with Index

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

the class ByteArrays_assertContains_at_Index_with_Integer_Argument_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, 6, index);
    } catch (AssertionError e) {
        byte found = 8;
        verify(failures).failure(info, shouldContainAtIndex(actual, (byte) 6, index, found, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Index(org.assertj.core.data.Index) ShouldContainAtIndex.shouldContainAtIndex(org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) ByteArraysBaseTest(org.assertj.core.internal.ByteArraysBaseTest) Test(org.junit.Test)

Example 40 with Index

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

the class ByteArrays_assertDoesNotContain_at_Index_Test method should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    byte value = 6;
    Index index = atIndex(0);
    try {
        arraysWithCustomComparisonStrategy.assertDoesNotContain(info, actual, value, index);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContainAtIndex(actual, value, index, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Index(org.assertj.core.data.Index) ShouldNotContainAtIndex.shouldNotContainAtIndex(org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex) Index.atIndex(org.assertj.core.data.Index.atIndex) ByteArraysBaseTest(org.assertj.core.internal.ByteArraysBaseTest) Test(org.junit.Test)

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