use of org.assertj.core.description.TextDescription 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.description.TextDescription 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.description.TextDescription 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.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldContain_create_Test method should_create_error_message_with_custom_comparison_strategy.
@Test
public void should_create_error_message_with_custom_comparison_strategy() {
factory = shouldContain(newArrayList("Yoda"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Luke"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
String message = factory.create(new TextDescription("Test"));
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[\"Yoda\"]>%n" + "to contain:%n" + " <[\"Luke\", \"Yoda\"]>%n" + "but could not find:%n" + " <[\"Luke\"]>%n" + "when comparing values using CaseInsensitiveStringComparator"));
}
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_double_from_float.
@Test
public void should_create_error_message_differentiating_double_from_float() {
factory = shouldContain(newArrayList(5d, 7d), newArrayList(5f, 7f), newLinkedHashSet(5f, 7f));
String message = factory.create(new TextDescription("Test"));
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[5.0, 7.0]>%n" + "to contain:%n" + " <[5.0f, 7.0f]>%n" + "but could not find:%n" + " <[5.0f, 7.0f]>%n" + ""));
}
Aggregations