use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldOnlyHaveElementsOfTypes_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
String message = factory.create(new TestDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[\"Yoda\", 42, \"Luke\"]>%n" + "to only have instances of:%n" + " <[java.lang.Number, java.lang.Long]>%n" + "but these elements are not:%n" + " <[\"Yoda\" (java.lang.String), \"Luke\" (java.lang.String)]>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldOnlyHaveFields_create_Test method should_not_display_fields_not_found_when_there_are_none_for_declared_fields.
@Test
public void should_not_display_fields_not_found_when_there_are_none_for_declared_fields() {
ErrorMessageFactory factory = shouldOnlyHaveDeclaredFields(Player.class, newLinkedHashSet("name", "team"), EMPTY_STRING_SET, newLinkedHashSet("address"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Player>%n" + "to only have the following declared fields:%n" + " <[\"name\", \"team\"]>%n" + "but the following fields were unexpected:%n" + " <[\"address\"]>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldOnlyHaveFields_create_Test method should_not_display_unexpected_fields_when_there_are_none_for_declared_fields.
@Test
public void should_not_display_unexpected_fields_when_there_are_none_for_declared_fields() {
ErrorMessageFactory factory = shouldOnlyHaveDeclaredFields(Player.class, newLinkedHashSet("name", "team"), newLinkedHashSet("nickname"), EMPTY_STRING_SET);
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Player>%n" + "to only have the following declared fields:%n" + " <[\"name\", \"team\"]>%n" + "but could not find the following fields:%n" + " <[\"nickname\"]>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldOnlyHaveFields_create_Test method should_create_error_message_for_fields.
@Test
public void should_create_error_message_for_fields() {
ErrorMessageFactory factory = shouldOnlyHaveFields(Player.class, newLinkedHashSet("name", "team"), newLinkedHashSet("nickname"), newLinkedHashSet("address"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Player>%n" + "to only have the following public accessible fields:%n" + " <[\"name\", \"team\"]>%n" + "fields not found:%n" + " <[\"nickname\"]>%n" + "and fields not expected:%n" + " <[\"address\"]>"));
}
use of org.assertj.core.presentation.StandardRepresentation in project assertj-core by joel-costigliola.
the class ShouldOnlyHaveFields_create_Test method should_create_error_message_for_declared_fields.
@Test
public void should_create_error_message_for_declared_fields() {
ErrorMessageFactory factory = shouldOnlyHaveDeclaredFields(Player.class, newLinkedHashSet("name", "team"), newLinkedHashSet("nickname"), newLinkedHashSet("address"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Player>%n" + "to only have the following declared fields:%n" + " <[\"name\", \"team\"]>%n" + "fields not found:%n" + " <[\"nickname\"]>%n" + "and fields not expected:%n" + " <[\"address\"]>"));
}
Aggregations