use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsExactly_Test method should_fail_if_actual_contains_all_given_values_but_size_differ.
@Test
public void should_fail_if_actual_contains_all_given_values_but_size_differ() {
AssertionInfo info = someInfo();
actual = newArrayList("Luke", "Leia", "Luke");
Object[] expected = { "Luke", "Leia" };
try {
iterables.assertContainsExactly(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainExactly(actual, asList(expected), newArrayList(), newArrayList("Luke")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsNull_Test method should_fail_if_actual_does_not_contain_null_whatever_custom_comparison_strategy_is.
@Test
public void should_fail_if_actual_does_not_contain_null_whatever_custom_comparison_strategy_is() {
AssertionInfo info = someInfo();
actual = newArrayList("Luke", "Yoda");
try {
iterablesWithCaseInsensitiveComparisonStrategy.assertContainsNull(info, actual);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainNull(actual));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnlyNulls_Test method should_fail_if_actual_contains_non_null_elements_only.
@Test
public void should_fail_if_actual_contains_non_null_elements_only() {
AssertionInfo info = someInfo();
actual = newArrayList("person", "person2");
List<String> nonNulls = newArrayList("person", "person2");
try {
iterables.assertContainsOnlyNulls(info, actual);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainOnlyNulls(actual, nonNulls));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnlyNulls_Test method should_fail_if_actual_is_empty.
@Test
public void should_fail_if_actual_is_empty() {
AssertionInfo info = someInfo();
try {
iterables.assertContainsOnlyNulls(info, actual);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainOnlyNulls(actual));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnlyNulls_Test method should_fail_if_actual_contains_null_and_non_null_elements.
@Test
public void should_fail_if_actual_contains_null_and_non_null_elements() {
AssertionInfo info = someInfo();
actual = newArrayList(null, null, "person");
List<String> nonNulls = newArrayList("person");
try {
iterables.assertContainsOnlyNulls(info, actual);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainOnlyNulls(actual, nonNulls));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
Aggregations