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_a_subset_of_expected_elements.
@Test
public void should_fail_if_actual_contains_a_subset_of_expected_elements() {
AssertionInfo info = someInfo();
Object[] expected = { "Luke", "Yoda", "Obiwan", "Leia" };
try {
iterables.assertContainsOnly(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainOnly(actual, expected, newArrayList("Obiwan"), newArrayList()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsSubsequence_Test method should_fail_if_actual_does_not_contain_whole_subsequence.
@Test
public void should_fail_if_actual_does_not_contain_whole_subsequence() {
AssertionInfo info = someInfo();
Object[] subsequence = { "Han", "C-3PO" };
try {
iterables.assertContainsSubsequence(info, actual, subsequence);
} catch (AssertionError e) {
verifyFailureThrownWhenSubsequenceNotFound(info, subsequence);
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsSubsequence_Test method should_fail_if_actual_contains_first_elements_of_subsequence_but_not_whole_subsequence.
@Test
public void should_fail_if_actual_contains_first_elements_of_subsequence_but_not_whole_subsequence() {
AssertionInfo info = someInfo();
Object[] subsequence = { "Luke", "Leia", "Han" };
try {
iterables.assertContainsSubsequence(info, actual, subsequence);
} catch (AssertionError e) {
verifyFailureThrownWhenSubsequenceNotFound(info, subsequence);
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContainsSubsequence_Test method should_fail_if_subsequence_is_bigger_than_actual.
@Test
public void should_fail_if_subsequence_is_bigger_than_actual() {
AssertionInfo info = someInfo();
Object[] subsequence = { "Luke", "Leia", "Obi-Wan", "Han", "C-3PO", "R2-D2", "Anakin" };
try {
iterables.assertContainsSubsequence(info, actual, subsequence);
} catch (AssertionError e) {
verifyFailureThrownWhenSubsequenceNotFound(info, subsequence);
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.
the class Iterables_assertContains_Test method should_fail_if_actual_does_not_contain_values.
@Test
public void should_fail_if_actual_does_not_contain_values() {
AssertionInfo info = someInfo();
Object[] expected = { "Han", "Luke" };
try {
iterables.assertContains(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContain(actual, expected, newLinkedHashSet("Han")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
Aggregations