Search in sources :

Example 91 with AssertionInfo

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

the class Integers_assertIsNotCloseTo_Test method should_fail_if_actual_is_too_close_to_the_other_value_with_strict_offset.

@Test
@DataProvider({ "1, 2, 10", "1, 0, 2", "0, 1, 2" })
public void should_fail_if_actual_is_too_close_to_the_other_value_with_strict_offset(int actual, int other, int offset) {
    AssertionInfo info = someInfo();
    try {
        integers.assertIsNotCloseTo(info, actual, other, byLessThan(offset));
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldNotBeEqual(actual, other, byLessThan(offset), abs(actual - other)));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) Test(org.junit.Test) IntegersBaseTest(org.assertj.core.internal.IntegersBaseTest)

Example 92 with AssertionInfo

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

the class Integers_assertIsStrictlyBetween_Test method should_fail_if_actual_is_equal_to_range_end.

@Test
public void should_fail_if_actual_is_equal_to_range_end() {
    AssertionInfo info = someInfo();
    try {
        integers.assertIsStrictlyBetween(info, ONE, ZERO, ONE);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldBeBetween(ONE, ZERO, ONE, false, false));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntegersBaseTest(org.assertj.core.internal.IntegersBaseTest) Test(org.junit.Test)

Example 93 with AssertionInfo

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

the class Integers_assertLessThan_Test method should_fail_if_actual_is_equal_to_other_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_is_equal_to_other_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    try {
        integersWithAbsValueComparisonStrategy.assertLessThan(info, 6, -6);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldBeLess(6, -6, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntegersBaseTest(org.assertj.core.internal.IntegersBaseTest) Test(org.junit.Test)

Example 94 with AssertionInfo

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

the class Integers_assertLessThan_Test method should_fail_if_actual_is_equal_to_other.

@Test
public void should_fail_if_actual_is_equal_to_other() {
    AssertionInfo info = someInfo();
    try {
        integers.assertLessThan(info, 6, 6);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldBeLess(6, 6));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntegersBaseTest(org.assertj.core.internal.IntegersBaseTest) Test(org.junit.Test)

Example 95 with AssertionInfo

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

the class Integers_assertLessThan_Test method should_fail_if_actual_is_greater_than_other_according_to_custom_comparison_strategy.

@Test
public void should_fail_if_actual_is_greater_than_other_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    try {
        integersWithAbsValueComparisonStrategy.assertLessThan(info, -8, 6);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldBeLess(-8, 6, absValueComparisonStrategy));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) IntegersBaseTest(org.assertj.core.internal.IntegersBaseTest) 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