use of org.assertj.core.description.TextDescription 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.description.TextDescription 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.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveMethods_create_Test method should_create_error_message_for_shouldNotHave_Public_Methods.
@Test
public void should_create_error_message_for_shouldNotHave_Public_Methods() {
ErrorMessageFactory factory = shouldNotHaveMethods(Person.class, Modifier.toString(Modifier.PUBLIC), false, newTreeSet("getName"));
String message = factory.create(new TextDescription("Test"), CONFIGURATION_PROVIDER.representation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Person>%n" + "not to have any public methods but it has the following:%n" + " <[\"getName\"]>"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveMethods_create_Test method should_create_error_message_for_shouldHaveMethods_with_non_matching_modifier.
@Test
public void should_create_error_message_for_shouldHaveMethods_with_non_matching_modifier() {
ErrorMessageFactory factory = shouldHaveMethods(Person.class, false, newTreeSet("finalize"), Modifier.toString(Modifier.PUBLIC), mapOf(entry("finalize", Modifier.toString(Modifier.PROTECTED))));
String message = factory.create(new TextDescription("Test"), CONFIGURATION_PROVIDER.representation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Person>%n" + "to have public methods:%n" + " <[\"finalize\"]>%n" + "but the following are not public:%n" + " <{\"finalize\"=\"protected\"}>"));
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveMethods_create_Test method should_create_error_message_for_methods.
@Test
public void should_create_error_message_for_methods() {
ErrorMessageFactory factory = shouldHaveMethods(Person.class, false, newTreeSet("getName", "getAddress"), newTreeSet("getAddress"));
String message = factory.create(new TextDescription("Test"), CONFIGURATION_PROVIDER.representation());
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting%n" + " <org.assertj.core.test.Person>%n" + "to have methods:%n" + " <[\"getAddress\", \"getName\"]>%n" + "but could not find:%n" + " <[\"getAddress\"]>"));
}
Aggregations