use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.
the class LongsBaseTest method setUp.
@Before
public void setUp() {
failures = spy(new Failures());
longs = new Longs();
longs.setFailures(failures);
absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Long>());
longsWithAbsValueComparisonStrategy = new Longs(absValueComparisonStrategy);
longsWithAbsValueComparisonStrategy.failures = failures;
}
use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.
the class ShouldContainSequenceOfCharSequence_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
String[] sequenceValues = { "{", "author", "title", "}" };
String actual = "{ 'title':'A Game of Thrones', 'author':'George Martin'}";
factory = shouldContainSequence(actual, sequenceValues, new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %nExpecting:%n" + " <\"{ 'title':'A Game of Thrones', 'author':'George Martin'}\">%n" + "to contain sequence:%n" + " <[\"{\", \"author\", \"title\", \"}\"]>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.
the class ShouldBeGreaterOrEqual_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
factory = shouldBeGreaterOrEqual(6, 8, new ComparatorBasedComparisonStrategy(new AbsValueComparator<Integer>()));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <6>%n" + "to be greater than or equal to:%n" + " <8> when comparing values using AbsValueComparator"));
}
use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.
the class ShouldBeGreater_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
factory = shouldBeGreater(6, 8, new ComparatorBasedComparisonStrategy(new AbsValueComparator<Integer>()));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <6>%n" + "to be greater than:%n" + " <8> when comparing values using AbsValueComparator"));
}
use of org.assertj.core.internal.ComparatorBasedComparisonStrategy in project assertj-core by joel-costigliola.
the class ShouldBeSubstringOf_create_Test method should_create_error_message_with_comparison_strategy.
@Test
public void should_create_error_message_with_comparison_strategy() {
ErrorMessageFactory factory = shouldBeSubstring("bcd", "abcdef", new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <\"bcd\">%n" + "to be a substring of:%n" + " <\"abcdef\">%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
Aggregations