use of org.assertj.core.presentation.StandardRepresentation 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"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldContainSubsequence_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\"]>%nto contain subsequence:%n <[\"Han\", \"Leia\"]>%n"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldContainValue_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
Map<?, ?> map = mapOf(entry("name", "Yoda"), entry("color", "green"));
ErrorMessageFactory factory = shouldContainValue(map, "VeryOld");
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <{\"color\"=\"green\", \"name\"=\"Yoda\"}>%n" + "to contain value:%n" + " <\"VeryOld\">"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldContainValues_create_Test method should_create_error_message_with_multiple_values.
@Test
public void should_create_error_message_with_multiple_values() {
Map<?, ?> map = mapOf(entry("name", "Yoda"), entry("color", "green"));
ErrorMessageFactory factory = shouldContainValues(map, newLinkedHashSet("VeryOld", "Vader"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <{\"color\"=\"green\", \"name\"=\"Yoda\"}>%n" + "to contain values:%n" + " <[\"VeryOld\", \"Vader\"]>"));
}
use of org.assertj.core.presentation.StandardRepresentation 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"));
}
Aggregations