Search in sources :

Example 61 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_actual_does_not_end_with_sequence.

@Test
public void should_fail_if_actual_does_not_end_with_sequence() {
    AssertionInfo info = someInfo();
    int[] sequence = { 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 62 with AssertionInfo

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

the class IntArrays_assertHasSameSizeAs_with_Array_Test method should_fail_if_size_of_actual_is_not_equal_to_expected_size.

@Test
public void should_fail_if_size_of_actual_is_not_equal_to_expected_size() {
    AssertionInfo info = someInfo();
    String[] other = array("Solo", "Leia", "Yoda", "Luke");
    thrown.expectAssertionError(shouldHaveSameSizeAs(actual, actual.length, other.length).create(null, info.representation()));
    arrays.assertHasSameSizeAs(info, actual, other);
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) Test(org.junit.Test)

Example 63 with AssertionInfo

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

the class IntArrays_assertIsSorted_Test method should_fail_if_actual_is_not_sorted_in_ascending_order.

@Test
public void should_fail_if_actual_is_not_sorted_in_ascending_order() {
    AssertionInfo info = someInfo();
    actual = arrayOf(1, 3, 2);
    try {
        arrays.assertIsSorted(info, actual);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldBeSorted(1, actual));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) Test(org.junit.Test)

Example 64 with AssertionInfo

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

the class IntArrays_assertIsSorted_Test method should_fail_if_actual_is_not_sorted_in_ascending_order_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_is_not_sorted_in_ascending_order_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    actual = arrayOf(1, 3, 2);
    try {
        arraysWithCustomComparisonStrategy.assertIsSorted(info, actual);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldBeSortedAccordingToGivenComparator(1, actual, comparatorForCustomComparisonStrategy()));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntArraysBaseTest(org.assertj.core.internal.IntArraysBaseTest) Test(org.junit.Test)

Example 65 with AssertionInfo

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

the class IntArrays_assertNotEmpty_Test method should_fail_if_actual_is_empty.

@Test
public void should_fail_if_actual_is_empty() {
    AssertionInfo info = someInfo();
    try {
        arrays.assertNotEmpty(info, emptyArray());
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotBeEmpty());
        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