Search in sources :

Example 26 with AssertionInfo

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_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_does_not_contain_values_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    Object[] expected = { "Han", "Luke" };
    try {
        iterablesWithCaseInsensitiveComparisonStrategy.assertContains(info, actual, expected);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldContain(actual, expected, newLinkedHashSet("Han"), comparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IterablesBaseTest(org.assertj.core.internal.IterablesBaseTest) Test(org.junit.Test)

Example 27 with AssertionInfo

use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.

the class Iterables_assertDoesNotContainAnyElementsOf_Test method should_fail_if_actual_contains_one_element_of_given_iterable_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_contains_one_element_of_given_iterable_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    List<String> expected = newArrayList("LuKe", "YODA", "Han");
    try {
        iterablesWithCaseInsensitiveComparisonStrategy.assertDoesNotContainAnyElementsOf(info, actual, expected);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContain(actual, expected.toArray(), newLinkedHashSet("LuKe", "YODA"), comparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IterablesBaseTest(org.assertj.core.internal.IterablesBaseTest) Test(org.junit.Test)

Example 28 with AssertionInfo

use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.

the class Iterables_assertDoesNotContainAnyElementsOf_Test method should_fail_if_actual_contains_one_element_of_given_iterable.

@Test
public void should_fail_if_actual_contains_one_element_of_given_iterable() {
    AssertionInfo info = someInfo();
    List<String> list = newArrayList("Vador", "Yoda", "Han");
    try {
        iterables.assertDoesNotContainAnyElementsOf(info, actual, list);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContain(actual, list.toArray(), newLinkedHashSet("Yoda")));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IterablesBaseTest(org.assertj.core.internal.IterablesBaseTest) Test(org.junit.Test)

Example 29 with AssertionInfo

use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.

the class Iterables_assertDoesNotContainSequence_Test method should_pass_if_actual_contains_first_elements_of_sequence_but_not_whole_sequence_according_to_custom_comparison_strategy.

@Test
public void should_pass_if_actual_contains_first_elements_of_sequence_but_not_whole_sequence_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    Object[] sequence = { "Luke", "Leia", "Han" };
    iterablesWithCaseInsensitiveComparisonStrategy.assertDoesNotContainSequence(info, actual, sequence);
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IterablesBaseTest(org.assertj.core.internal.IterablesBaseTest) Test(org.junit.Test)

Example 30 with AssertionInfo

use of org.assertj.core.api.AssertionInfo in project assertj-core by joel-costigliola.

the class Iterables_assertDoesNotContainSequence_Test method should_fail_if_actual_contains_sequence_that_specifies_multiple_times_the_same_value.

@Test
public void should_fail_if_actual_contains_sequence_that_specifies_multiple_times_the_same_value() {
    AssertionInfo info = someInfo();
    actual = newArrayList("a", "-", "b", "-", "c");
    Object[] sequence = { "a", "-", "b", "-", "c" };
    try {
        iterables.assertDoesNotContainSequence(info, actual, sequence);
    } catch (AssertionError e) {
        verifyFailureThrownWhenSequenceNotFound(info, sequence, 0);
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IterablesBaseTest(org.assertj.core.internal.IterablesBaseTest) Test(org.junit.Test)

Aggregations

AssertionInfo (org.assertj.core.api.AssertionInfo)1174 Test (org.junit.Test)1172 IterablesBaseTest (org.assertj.core.internal.IterablesBaseTest)94 DatesBaseTest (org.assertj.core.internal.DatesBaseTest)92 ByteArraysBaseTest (org.assertj.core.internal.ByteArraysBaseTest)84 ObjectArraysBaseTest (org.assertj.core.internal.ObjectArraysBaseTest)84 Date (java.util.Date)60 CharArraysBaseTest (org.assertj.core.internal.CharArraysBaseTest)47 FloatArraysBaseTest (org.assertj.core.internal.FloatArraysBaseTest)47 IntArraysBaseTest (org.assertj.core.internal.IntArraysBaseTest)47 LongArraysBaseTest (org.assertj.core.internal.LongArraysBaseTest)47 MapsBaseTest (org.assertj.core.internal.MapsBaseTest)47 ShortArraysBaseTest (org.assertj.core.internal.ShortArraysBaseTest)47 BigIntegersBaseTest (org.assertj.core.internal.BigIntegersBaseTest)44 BigDecimalsBaseTest (org.assertj.core.internal.BigDecimalsBaseTest)42 Index (org.assertj.core.data.Index)40 Index.atIndex (org.assertj.core.data.Index.atIndex)40 ObjectsBaseTest (org.assertj.core.internal.ObjectsBaseTest)40 DataProvider (com.tngtech.java.junit.dataprovider.DataProvider)34 DoublesBaseTest (org.assertj.core.internal.DoublesBaseTest)33