use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotContainKeys_create_Test method should_create_error_message_with_multiple_keys.
@Test
public void should_create_error_message_with_multiple_keys() {
ErrorMessageFactory factory = shouldNotContainKeys(map, newLinkedHashSet("name", "color"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <{\"color\"=\"green\", \"name\"=\"Yoda\"}>%n" + "not to contain keys:%n" + " <[\"name\", \"color\"]>"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotContainOnlyWhitespaces_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
// GIVEN
ErrorMessageFactory factory = shouldNotContainOnlyWhitespaces(" ");
// WHEN
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
// THEN
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting string not to contain only whitespaces but was:%n" + " <\" \">"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotContainString_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
ErrorMessageFactory factory = shouldNotContain("Yoda", "od", new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), STANDARD_REPRESENTATION);
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <\"Yoda\">%n" + "not to contain:%n" + " <\"od\">%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotContain_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
ErrorMessageFactory factory = shouldNotContain(newArrayList("Yoda"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Yoda"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting%n" + " <[\"Yoda\"]>%n" + "not to contain%n" + " <[\"Luke\", \"Yoda\"]>%n" + "but found%n" + " <[\"Yoda\"]>%n"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldNotContain_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
ErrorMessageFactory factory = shouldNotContain(newArrayList("Yoda"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Yoda"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting%n" + " <[\"Yoda\"]>%n" + "not to contain%n" + " <[\"Luke\", \"Yoda\"]>%n" + "but found%n <[\"Yoda\"]>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
Aggregations