use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotEndWith_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
factory = shouldNotEndWith(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] %n" + "Expecting:%n" + " <[\"Yoda\", \"Luke\"]>%n" + "not to end with:%n" + " <[\"Han\", \"Leia\"]>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveSameHashCode_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
// GIVEN
Object actual = new FixedHashCode(123);
Object expected = new FixedHashCode(456);
// WHEN
String message = shouldHaveSameHashCode(actual, expected).create(new TextDescription("Test"), STANDARD_REPRESENTATION);
// THEN
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <FixedHashCode[code=123]>%n" + "to have the same hash code as:%n" + " <FixedHashCode[code=456]>%n" + "but actual hash code is%n" + " <123>%n" + "while expected hash code was:%n" + " <456>"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveSameHourAs_create_Test method should_create_error_message_localtime.
@Test
public void should_create_error_message_localtime() {
factory = shouldHaveSameHourAs(LocalTime.of(12, 0), LocalTime.of(13, 0));
assertThat(factory.create(new TextDescription("Test"), new StandardRepresentation())).isEqualTo(format("[Test] %nExpecting:%n <12:00>%nto have same hour as:%n <13:00>%nbut had not."));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveSameHourAs_create_Test method should_create_error_message_offset.
@Test
public void should_create_error_message_offset() {
factory = shouldHaveSameHourAs(OffsetTime.of(12, 0, 0, 0, ZoneOffset.UTC), OffsetTime.of(13, 0, 0, 0, ZoneOffset.UTC));
assertThat(factory.create(new TextDescription("Test"), new StandardRepresentation())).isEqualTo(format("[Test] %nExpecting:%n <12:00Z>%nto have same hour as:%n <13:00Z>%nbut had not."));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveSameTime_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
Date actual = DateUtil.parseDatetime("2011-01-01T05:01:00");
Date expected = DateUtil.parseDatetime("2011-01-01T05:01:01");
String message = shouldHaveSameTime(actual, expected).create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <2011-01-01T05:01:00.000>%n" + "to have the same time as:%n" + " <2011-01-01T05:01:01.000>%n" + "but actual time is%n" + " <" + actual.getTime() + "L>%n" + "and expected was:%n" + " <" + expected.getTime() + "L>"));
}
Aggregations