Search in sources :

Example 11 with ComparatorBasedComparisonStrategy

use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.

the class ComparatorBasedComparisonStrategy_isGreaterThan_Test method verify_that_isGreaterThan_delegates_to_compare_method.

@Test
public void verify_that_isGreaterThan_delegates_to_compare_method() {
    caseInsensitiveStringComparator = mock(CaseInsensitiveStringComparator.class);
    caseInsensitiveComparisonStrategy = new ComparatorBasedComparisonStrategy(caseInsensitiveStringComparator);
    String s1 = "string1";
    String s2 = "string2";
    caseInsensitiveComparisonStrategy.isGreaterThan(s1, s2);
    verify(caseInsensitiveStringComparator).compare(s1, s2);
}
Also used : ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Test(org.junit.Test)

Example 12 with ComparatorBasedComparisonStrategy

use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.

the class CharactersBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    characters = new Characters();
    characters.failures = failures;
    caseInsensitiveComparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveCharacterComparator.instance);
    charactersWithCaseInsensitiveComparisonStrategy = new Characters(caseInsensitiveComparisonStrategy);
    charactersWithCaseInsensitiveComparisonStrategy.failures = failures;
}
Also used : Characters(org.assertj.core.internal.Characters) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

Example 13 with ComparatorBasedComparisonStrategy

use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.

the class ComparablesBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    comparables = new Comparables();
    comparables.failures = failures;
    customComparisonStrategy = new ComparatorBasedComparisonStrategy(comparatorForCustomComparisonStrategy());
    comparablesWithCustomComparisonStrategy = new Comparables(customComparisonStrategy);
    comparablesWithCustomComparisonStrategy.failures = failures;
}
Also used : ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Comparables(org.assertj.core.internal.Comparables) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

Example 14 with ComparatorBasedComparisonStrategy

use of org.assertj.core.internal.ComparatorBasedComparisonStrategy 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 15 with ComparatorBasedComparisonStrategy

use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.

the class IterableAssert_usingComparatorForType_Test method verify_internal_effects.

@Override
protected void verify_internal_effects() {
    Iterables iterables = getIterables(assertions);
    assertThat(iterables).isNotSameAs(iterablesBefore);
    assertThat(iterables.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    ComparatorBasedComparisonStrategy strategy = (ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy();
    assertThat(strategy.getComparator()).isInstanceOf(ExtendedByTypesComparator.class);
}
Also used : ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Iterables(org.assertj.core.internal.Iterables)

Aggregations

ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)64 Test (org.junit.Test)26 TextDescription (org.assertj.core.description.TextDescription)24 StandardRepresentation (org.assertj.core.presentation.StandardRepresentation)22 CheckReturnValue (org.assertj.core.util.CheckReturnValue)18 Failures (org.assertj.core.internal.Failures)10 Before (org.junit.Before)10 ObjectArrays (org.assertj.core.internal.ObjectArrays)8 Iterables (org.assertj.core.internal.Iterables)6 AbsValueComparator (org.assertj.core.util.AbsValueComparator)5 IgnoringFieldsComparator (org.assertj.core.internal.IgnoringFieldsComparator)4 Integers (org.assertj.core.internal.Integers)3 Lists (org.assertj.core.internal.Lists)3 Longs (org.assertj.core.internal.Longs)3 Objects (org.assertj.core.internal.Objects)3 OnFieldsComparator (org.assertj.core.internal.OnFieldsComparator)3 Characters (org.assertj.core.internal.Characters)2 Comparables (org.assertj.core.internal.Comparables)2 Doubles (org.assertj.core.internal.Doubles)2 Floats (org.assertj.core.internal.Floats)2