Search in sources :

Example 1 with AbsValueComparator

use of org.assertj.core.util.AbsValueComparator in project assertj-core by joel-costigliola.

the class FloatsBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    floats = new Floats();
    floats.setFailures(failures);
    absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Float>());
    floatsWithAbsValueComparisonStrategy = new Floats(absValueComparisonStrategy);
    floatsWithAbsValueComparisonStrategy.failures = failures;
}
Also used : AbsValueComparator(org.assertj.core.util.AbsValueComparator) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Floats(org.assertj.core.internal.Floats) Before(org.junit.Before)

Example 2 with AbsValueComparator

use of org.assertj.core.util.AbsValueComparator in project assertj-core by joel-costigliola.

the class ShortsBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    shorts = new Shorts();
    shorts.setFailures(failures);
    absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Short>());
    shortsWithAbsValueComparisonStrategy = new Shorts(absValueComparisonStrategy);
    shortsWithAbsValueComparisonStrategy.failures = failures;
}
Also used : AbsValueComparator(org.assertj.core.util.AbsValueComparator) Shorts(org.assertj.core.internal.Shorts) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

Example 3 with AbsValueComparator

use of org.assertj.core.util.AbsValueComparator in project assertj-core by joel-costigliola.

the class AtomicIntegerArrayAssert_hasArray_Test method should_honor_the_given_element_comparator.

@Test
public void should_honor_the_given_element_comparator() {
    AtomicIntegerArray actual = new AtomicIntegerArray(new int[] { 1, 2, 3 });
    assertThat(actual).usingElementComparator(new AbsValueComparator<Integer>()).hasArray(new int[] { -1, 2, 3 });
}
Also used : AtomicIntegerArray(java.util.concurrent.atomic.AtomicIntegerArray) AbsValueComparator(org.assertj.core.util.AbsValueComparator) AtomicIntegerArrayAssertBaseTest(org.assertj.core.api.AtomicIntegerArrayAssertBaseTest) Test(org.junit.Test)

Example 4 with AbsValueComparator

use of org.assertj.core.util.AbsValueComparator in project assertj-core by joel-costigliola.

the class AtomicLongArrayAssert_hasArray_Test method should_honor_the_given_element_comparator.

@Test
public void should_honor_the_given_element_comparator() {
    AtomicLongArray actual = new AtomicLongArray(new long[] { 1, 2, 3 });
    assertThat(actual).usingElementComparator(new AbsValueComparator<Long>()).hasArray(new long[] { -1, 2, 3 });
}
Also used : AbsValueComparator(org.assertj.core.util.AbsValueComparator) AtomicLongArray(java.util.concurrent.atomic.AtomicLongArray) AtomicLongArrayAssertBaseTest(org.assertj.core.api.AtomicLongArrayAssertBaseTest) Test(org.junit.Test)

Example 5 with AbsValueComparator

use of org.assertj.core.util.AbsValueComparator in project assertj-core by joel-costigliola.

the class AtomicLongArrayAssert_usingElementComparator_Test method should_honor_the_given_element_comparator.

@Test
public void should_honor_the_given_element_comparator() {
    AtomicLongArray actual = new AtomicLongArray(new long[] { 1, 2, 3, 4 });
    assertThat(actual).usingElementComparator(new AbsValueComparator<Long>()).containsExactly(-1, 2, 3, -4);
}
Also used : AbsValueComparator(org.assertj.core.util.AbsValueComparator) AtomicLongArray(java.util.concurrent.atomic.AtomicLongArray) AtomicLongArrayAssertBaseTest(org.assertj.core.api.AtomicLongArrayAssertBaseTest) Test(org.junit.Test)

Aggregations

AbsValueComparator (org.assertj.core.util.AbsValueComparator)9 ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)5 Failures (org.assertj.core.internal.Failures)5 Before (org.junit.Before)5 Test (org.junit.Test)4 AtomicIntegerArray (java.util.concurrent.atomic.AtomicIntegerArray)2 AtomicLongArray (java.util.concurrent.atomic.AtomicLongArray)2 AtomicIntegerArrayAssertBaseTest (org.assertj.core.api.AtomicIntegerArrayAssertBaseTest)2 AtomicLongArrayAssertBaseTest (org.assertj.core.api.AtomicLongArrayAssertBaseTest)2 Doubles (org.assertj.core.internal.Doubles)1 Floats (org.assertj.core.internal.Floats)1 Integers (org.assertj.core.internal.Integers)1 Longs (org.assertj.core.internal.Longs)1 Shorts (org.assertj.core.internal.Shorts)1