use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotBeBetween_create_Test method should_create_error_message_with_period_boundaries_excluded.
@Test
public void should_create_error_message_with_period_boundaries_excluded() {
ErrorMessageFactory factory = shouldNotBeBetween(parse("2011-01-01"), parse("2011-01-01"), parse("2012-01-01"), false, false);
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <2011-01-01T00:00:00.000>%n" + "not to be in period:%n" + " ]2011-01-01T00:00:00.000, 2012-01-01T00:00:00.000["));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotBeIn_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" + " <\"Luke\">%n" + "not to be in:%n" + " <[\"Luke\", \"Leia\"]>%n"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotBeIn_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
factory = shouldNotBeIn("Luke", array("Luke", "Leia"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <\"Luke\">%n" + "not to be in:%n" + " <[\"Luke\", \"Leia\"]>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotContainAtIndex_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] %nExpecting:%n <[\"Yoda\", \"Luke\"]>%nnot to contain:%n <\"Luke\">%nat index <1>%n"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class LongPredicateAssert_rejects_Test method should_fail_when_predicate_accepts_value_with_description.
@Test
public void should_fail_when_predicate_accepts_value_with_description() {
LongPredicate predicate = val -> val <= 2;
Predicate<Long> wrapPredicate = predicate::test;
long expectedValue = 2;
thrown.expectAssertionError("[test] " + shouldNotAccept(wrapPredicate, expectedValue, PredicateDescription.GIVEN).create());
assertThat(predicate).as(new TextDescription("test")).rejects(expectedValue);
}
Aggregations