use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContain_create_Test method should_create_error_message_differentiating_long_from_integer_in_arrays.
@Test
public void should_create_error_message_differentiating_long_from_integer_in_arrays() {
factory = shouldContain(newArrayList(5L, 7L), newArrayList(5, 7), newLinkedHashSet(5, 7));
String message = factory.create(new TextDescription("Test"));
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[5L, 7L]>%n" + "to contain:%n" + " <[5, 7]>%n" + "but could not find:%n" + " <[5, 7]>%n" + ""));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainsAnyOf_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
ErrorMessageFactory factory = shouldContainAnyOf(newArrayList("Yoda", "Han", "Han"), newArrayList("Vador", "Leia"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), CONFIGURATION_PROVIDER.representation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[\"Yoda\", \"Han\", \"Han\"]>%n" + "to contain at least one of the following elements:%n" + " <[\"Vador\", \"Leia\"]>%n" + "but none were found " + "when comparing values using CaseInsensitiveStringComparator"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainsAnyOf_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
String message = factory.create(new TextDescription("Test"), CONFIGURATION_PROVIDER.representation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[\"Yoda\", \"Han\", \"Han\"]>%n" + "to contain at least one of the following elements:%n" + " <[\"Vador\", \"Leia\"]>%n" + "but none were found "));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainsOnlyOnce_create_Test method should_create_error_message_without_elements_found_many_times.
@Test
public void should_create_error_message_without_elements_found_many_times() {
factory = shouldContainsOnlyOnce(newArrayList("Yoda", "Han"), newArrayList("Luke"), newLinkedHashSet("Luke"), newLinkedHashSet());
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n" + " <[\"Yoda\", \"Han\"]>%n" + "to contain only once:%n" + " <[\"Luke\"]>%n" + "but some elements were not found:%n" + " <[\"Luke\"]>%n"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainsOnlyOnce_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\", \"Han\", \"Han\"]>%n" + "to contain only once:%n" + " <[\"Luke\", \"Yoda\"]>%n" + "but some elements were not found:%n" + " <[\"Luke\"]>%n" + "and others were found more than once:%n" + " <[\"Han\"]>%n"));
}
Aggregations