use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainSequence_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
ErrorMessageFactory factory = shouldContainSequence(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[\"Yoda\", \"Luke\"]>%n" + "to contain sequence:%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 ShouldContainString_create_Test method should_create_error_message_when_ignoring_case.
@Test
public void should_create_error_message_when_ignoring_case() {
factory = shouldContainIgnoringCase("Yoda", "Luke");
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n <\"Yoda\">%nto contain:%n <\"Luke\">%n (ignoring case)"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainString_create_Test method should_create_error_message_with_several_string_values.
@Test
public void should_create_error_message_with_several_string_values() {
factory = shouldContain("Yoda, Luke", array("Luke", "Vador", "Solo"), newSet("Vador", "Solo"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n <\"Yoda, Luke\">%nto contain:%n <[\"Luke\", \"Vador\", \"Solo\"]>%nbut could not find:%n <[\"Vador\", \"Solo\"]>%n "));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainSubsequenceOfCharSequence_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
String[] sequenceValues = { "{", "author", "title", "}" };
String actual = "{ 'title':'A Game of Thrones', 'author':'George Martin'}";
factory = shouldContainSubsequence(actual, sequenceValues, 1);
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %nExpecting:%n" + " <\"" + actual + "\">%n" + "to contain the following CharSequences in this order:%n" + " <[\"{\", \"author\", \"title\", \"}\"]>%n" + "but <\"title\"> was found before <\"author\">%n"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContainSubsequenceOfCharSequence_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
String[] sequenceValues = { "{", "author", "title", "}" };
String actual = "{ 'title':'A Game of Thrones', 'author':'George Martin'}";
factory = shouldContainSubsequence(actual, sequenceValues, 1, new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %nExpecting:%n" + " <\"" + actual + "\">%n" + "to contain the following CharSequences in this order:%n" + " <[\"{\", \"author\", \"title\", \"}\"]>%n" + "but <\"title\"> was found before <\"author\">%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
Aggregations