use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnlyOnce_Test method should_fail_if_actual_does_not_contain_given_values_only_according_to_custom_comparison_strategy.
@Test
public void should_fail_if_actual_does_not_contain_given_values_only_according_to_custom_comparison_strategy() {
AssertionInfo info = someInfo();
Object[] expected = { "Luke", "Yoda", "Han" };
try {
iterablesWithCaseInsensitiveComparisonStrategy.assertContainsOnlyOnce(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainsOnlyOnce(actual, expected, newLinkedHashSet("Han"), newLinkedHashSet(), comparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnlyOnce_Test method should_fail_if_actual_contains_given_values_more_than_once_even_if_duplicated_according_to_custom_comparison_strategy.
@Test
public void should_fail_if_actual_contains_given_values_more_than_once_even_if_duplicated_according_to_custom_comparison_strategy() {
AssertionInfo info = someInfo();
actual.addAll(newArrayList("LUKE"));
Object[] expected = array("LUke", "LUke", "lukE", "YOda", "Leia", "Han");
try {
iterablesWithCaseInsensitiveComparisonStrategy.assertContainsOnlyOnce(someInfo(), actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainsOnlyOnce(actual, expected, newLinkedHashSet("Han"), newLinkedHashSet("LUke", "lukE"), comparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnlyOnce_Test method should_fail_if_actual_contains_given_values_more_than_once.
@Test
public void should_fail_if_actual_contains_given_values_more_than_once() {
AssertionInfo info = someInfo();
actual.addAll(newArrayList("Luke", "Luke", null, null));
Object[] expected = { "Luke", "Luke", "Yoda", "Han", null };
try {
iterables.assertContainsOnlyOnce(someInfo(), actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainsOnlyOnce(actual, expected, newLinkedHashSet("Han"), newLinkedHashSet("Luke", null)));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnly_Test method should_fail_if_actual_contains_additional_elements.
@Test
public void should_fail_if_actual_contains_additional_elements() {
AssertionInfo info = someInfo();
Object[] expected = { "Luke", "Yoda" };
try {
iterables.assertContainsOnly(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainOnly(actual, expected, newArrayList(), newArrayList("Leia")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsOnly_Test method should_fail_if_actual_does_not_contain_all_given_values.
@Test
public void should_fail_if_actual_does_not_contain_all_given_values() {
AssertionInfo info = someInfo();
Object[] expected = { "Luke", "Yoda", "Han" };
try {
iterables.assertContainsOnly(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainOnly(actual, expected, newArrayList("Han"), newArrayList("Leia")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
Aggregations