use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldBeInSameSecondWindow_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
ErrorMessageFactory factory = shouldBeInSameSecondWindow(parseDatetimeWithMs("2011-01-01T05:00:01.000"), parseDatetimeWithMs("2011-01-01T05:00:02.001"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <2011-01-01T05:00:01.000>%n" + "to be close to:%n" + " <2011-01-01T05:00:02.001>%n" + "by less than one second (strictly) but difference was: 1s and 1ms"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldBeIn_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
factory = shouldBeIn("Yoda", array("Luke", "Leia"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n <\"Yoda\">%nto be in:%n <[\"Luke\", \"Leia\"]>%nwhen comparing values using CaseInsensitiveStringComparator"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldBeLess_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <8>%n" + "to be less than:%n" + " <6> "));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldBeLowerCase_create_Test method should_create_error_message_for_string.
@Test
public void should_create_error_message_for_string() {
String message = shouldBeLowerCase("ABC").create(new TextDescription("Test"), STANDARD_REPRESENTATION);
assertThat(message).isEqualTo(format("[Test] %nExpecting <\"ABC\"> to be a lowercase"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldBeLowerCase_create_Test method should_create_error_message_for_character.
@Test
public void should_create_error_message_for_character() {
String message = shouldBeLowerCase('A').create(new TextDescription("Test"), STANDARD_REPRESENTATION);
assertThat(message).isEqualTo(format("[Test] %nExpecting <'A'> to be a lowercase"));
}
Aggregations