Search in sources :

Example 51 with ComparatorBasedComparisonStrategy

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

the class ShouldNotContainAtIndex_create_Test method should_create_error_message_with_custom_comparison_strategy.

@Test
public void should_create_error_message_with_custom_comparison_strategy() {
    factory = shouldNotContainAtIndex(newArrayList("Yoda", "Luke"), "Luke", atIndex(1), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n <[\"Yoda\", \"Luke\"]>%nnot to contain:%n <\"Luke\">%n" + "at index <1>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Test(org.junit.Test)

Example 52 with ComparatorBasedComparisonStrategy

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

the class ShouldEndWith_create_Test method should_create_error_message_with_custom_comparison_strategy.

@Test
public void should_create_error_message_with_custom_comparison_strategy() {
    factory = shouldEndWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n <[\"Yoda\", \"Luke\"]>%nto end with:%n <[\"Han\", \"Leia\"]>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Test(org.junit.Test)

Example 53 with ComparatorBasedComparisonStrategy

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

the class DoublesBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    doubles = new Doubles();
    doubles.setFailures(failures);
    absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Double>());
    doublesWithAbsValueComparisonStrategy = new Doubles(absValueComparisonStrategy);
    doublesWithAbsValueComparisonStrategy.failures = failures;
}
Also used : Doubles(org.assertj.core.internal.Doubles) AbsValueComparator(org.assertj.core.util.AbsValueComparator) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

Example 54 with ComparatorBasedComparisonStrategy

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

the class IntegersBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    integers = new Integers();
    integers.setFailures(failures);
    absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Integer>());
    integersWithAbsValueComparisonStrategy = new Integers(absValueComparisonStrategy);
    integersWithAbsValueComparisonStrategy.failures = failures;
}
Also used : Integers(org.assertj.core.internal.Integers) AbsValueComparator(org.assertj.core.util.AbsValueComparator) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

Example 55 with ComparatorBasedComparisonStrategy

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

the class ListsBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    lists = new Lists();
    lists.failures = failures;
    comparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance);
    listsWithCaseInsensitiveComparisonStrategy = new Lists(comparisonStrategy);
    listsWithCaseInsensitiveComparisonStrategy.failures = failures;
}
Also used : Lists(org.assertj.core.internal.Lists) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

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