use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.
the class Lists_assertContains_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 {
lists.assertContains(info, actual, "Han", index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainAtIndex(actual, "Han", index, "Luke"));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.
the class Lists_assertContains_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 {
listsWithCaseInsensitiveComparisonStrategy.assertContains(info, actual, "Han", index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainAtIndex(actual, "Han", index, "Luke", comparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.
the class Lists_assertHas_Test method should_fail_if_actual_does_not_satisfy_condition_at_index.
@Test
public void should_fail_if_actual_does_not_satisfy_condition_at_index() {
condition.shouldMatch(false);
AssertionInfo info = someInfo();
Index index = atIndex(1);
try {
lists.assertHas(info, actual, condition, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldHaveAtIndex(actual, condition, index, "Luke"));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.
the class LongArrays_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();
long value = 6;
Index index = atIndex(1);
try {
arraysWithCustomComparisonStrategy.assertContains(info, actual, value, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainAtIndex(actual, value, index, 8L, absValueComparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.data.Index in project assertj-core by joel-costigliola.
the class ByteArrays_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() {
AssertionInfo info = someInfo();
byte value = 6;
Index index = atIndex(1);
try {
arrays.assertContains(info, actual, value, index);
} catch (AssertionError e) {
byte found = 8;
verify(failures).failure(info, shouldContainAtIndex(actual, value, index, found));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
Aggregations