Search in sources :

Example 96 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ElementsShouldBeAtMost_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 elements:%n<[\"Yoda\", \"Luke\", \"Obiwan\"]>%n to be at most 2 times <a Jedi>"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 97 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ElementsShouldHaveAtLeast_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 elements:%n<[\"Yoda\", \"Solo\", \"Leia\"]>%n to have at least 2 times <Jedi power>"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 98 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ElementsShouldMatch_create_Test method should_create_error_message_with_one_non_matching_element.

@Test
public void should_create_error_message_with_one_non_matching_element() {
    ErrorMessageFactory factory = elementsShouldMatch(newArrayList("Luke", "Yoda"), "Yoda", PredicateDescription.GIVEN);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(format("[Test] %n" + "Expecting all elements of:%n" + "  <[\"Luke\", \"Yoda\"]>%n" + "to match given predicate but this element did not:%n" + "  <\"Yoda\">"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 99 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ElementsShouldMatch_create_Test method should_create_error_message_with_multiple_non_matching_elements.

@Test
public void should_create_error_message_with_multiple_non_matching_elements() {
    ErrorMessageFactory factory = elementsShouldMatch(newArrayList("Luke", "Yoda"), newArrayList("Luke", "Yoda"), PredicateDescription.GIVEN);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(format("[Test] %n" + "Expecting all elements of:%n" + "  <[\"Luke\", \"Yoda\"]>%n" + "to match given predicate but these elements did not:%n" + "  <[\"Luke\", \"Yoda\"]>"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 100 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ElementsShouldNotBe_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 elements:%n<[\"Yoda\"]>%n of %n<[\"Darth Vader\", \"Leia\", \"Yoda\"]>%n not to be <not a Jedi>"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Aggregations

TextDescription (org.assertj.core.description.TextDescription)210 Test (org.junit.Test)210 StandardRepresentation (org.assertj.core.presentation.StandardRepresentation)157 ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)24 PredicateDescription (org.assertj.core.presentation.PredicateDescription)8 Jedi (org.assertj.core.test.Jedi)6 Path (java.nio.file.Path)4 Integer.toHexString (java.lang.Integer.toHexString)3 Date (java.util.Date)3 Description (org.assertj.core.description.Description)3 Difference (org.assertj.core.internal.DeepDifference.Difference)3 BaseTest (org.assertj.core.api.BaseTest)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 LongPredicate (java.util.function.LongPredicate)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 LongStream (java.util.stream.LongStream)1