Search in sources :

Example 56 with AssertionInfo

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

the class Iterables_assertAre_Test method should_fail_if_condition_is_not_met.

@Test
public void should_fail_if_condition_is_not_met() {
    testCondition.shouldMatch(false);
    AssertionInfo info = someInfo();
    try {
        actual = newArrayList("Yoda", "Luke", "Leia");
        iterables.assertAre(someInfo(), actual, jedi);
    } catch (AssertionError e) {
        verify(conditions).assertIsNotNull(jedi);
        verify(failures).failure(info, elementsShouldBe(actual, newArrayList("Leia"), jedi));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Test(org.junit.Test) IterablesWithConditionsBaseTest(org.assertj.core.internal.IterablesWithConditionsBaseTest)

Example 57 with AssertionInfo

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

the class IntArrays_assertDoesNotContain_Test method should_fail_if_actual_contains_given_values.

@Test
public void should_fail_if_actual_contains_given_values() {
    AssertionInfo info = someInfo();
    int[] expected = { 6, 8, 20 };
    try {
        arrays.assertDoesNotContain(info, actual, expected);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotContain(actual, expected, newLinkedHashSet(6, 8)));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) Test(org.junit.Test)

Example 58 with AssertionInfo

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

the class IntArrays_assertDoesNotHaveDuplicates_Test method should_fail_if_actual_contains_duplicates_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_contains_duplicates_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    actual = arrayOf(6, -8, 6, 8);
    try {
        arraysWithCustomComparisonStrategy.assertDoesNotHaveDuplicates(info, actual);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotHaveDuplicates(actual, newLinkedHashSet(6, 8), absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) Test(org.junit.Test)

Example 59 with AssertionInfo

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

the class IntArrays_assertEndsWith_Test method should_fail_if_sequence_is_bigger_than_actual.

@Test
public void should_fail_if_sequence_is_bigger_than_actual() {
    AssertionInfo info = someInfo();
    int[] sequence = { 6, 8, 10, 12, 20, 22 };
    try {
        arrays.assertEndsWith(info, actual, sequence);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldEndWith(actual, sequence));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) Test(org.junit.Test)

Example 60 with AssertionInfo

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

the class IntArrays_assertEndsWith_Test method should_fail_if_sequence_is_bigger_than_actual_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_sequence_is_bigger_than_actual_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    int[] sequence = { 6, -8, 10, 12, 20, 22 };
    try {
        arraysWithCustomComparisonStrategy.assertEndsWith(info, actual, sequence);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldEndWith(actual, sequence, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) 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