use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldHaveFields_create_Test method should_create_error_message_for_fields.
@Test
public void should_create_error_message_for_fields() {
ErrorMessageFactory factory = shouldHaveFields(Person.class, newLinkedHashSet("name", "address"), newLinkedHashSet("address"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Person>%n" + "to have the following public accessible fields:%n" + " <[\"name\", \"address\"]>%n" + "but it doesn't have:%n" + " <[\"address\"]>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldHaveFields_create_Test method should_create_error_message_for_declared_fields.
@Test
public void should_create_error_message_for_declared_fields() {
ErrorMessageFactory factory = shouldHaveDeclaredFields(Person.class, newLinkedHashSet("name", "address"), newLinkedHashSet("address"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Person>%n" + "to have the following declared fields:%n" + " <[\"name\", \"address\"]>%n" + "but it doesn't have:%n" + " <[\"address\"]>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldHaveNoParent_create_Test method setup.
@Before
public void setup() {
description = new TestDescription("Test");
representation = new StandardRepresentation();
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldHaveOnlyElementsOfType_create_Test method should_create_error_message_for_array.
@Test
public void should_create_error_message_for_array() {
Object[] array = new Object[] { "Yoda", 5L };
ErrorMessageFactory factory = shouldHaveOnlyElementsOfType(array, String.class, Long.class);
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <[\"Yoda\", 5L]>%n" + "to only have elements of type:%n" + " <java.lang.String>%n" + "but found:%n" + " <java.lang.Long>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldHaveParent_create_Test method setup.
@Before
public void setup() {
description = new TestDescription("Test");
representation = new StandardRepresentation();
}
Aggregations