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_shouldNotHaveMethods.
@Test
public void should_create_error_message_for_shouldNotHaveMethods() {
ErrorMessageFactory factory = shouldNotHaveMethods(Person.class, 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 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_shouldNotHave_Declared_Methods.
@Test
public void should_create_error_message_for_shouldNotHave_Declared_Methods() {
ErrorMessageFactory factory = shouldNotHaveMethods(Person.class, true, 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 declared methods but it has the following:%n" + " <[\"getName\"]>"));
}
use of org.assertj.core.description.TextDescription 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.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveSameContent_create_Test method should_create_error_message_inputstream_even_if_content_contains_format_specifier.
@Test
public void should_create_error_message_inputstream_even_if_content_contains_format_specifier() {
ErrorMessageFactory factory = shouldHaveSameContent(new ByteArrayInputStream(new byte[] { 'a' }), new ByteArrayInputStream(new byte[] { 'b' }), emptyList());
String expectedErrorMessage = format("[Test] %nInputStreams do not have same content:%n");
assertThat(factory.create(new TextDescription("Test"), new StandardRepresentation())).isEqualTo(expectedErrorMessage);
}
use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.
the class ShouldHaveSameContent_create_Test method should_create_error_message_file_even_if_content_contains_format_specifier.
@Test
public void should_create_error_message_file_even_if_content_contains_format_specifier() {
ErrorMessageFactory factory = shouldHaveSameContent(new FakeFile("abc"), new FakeFile("xyz"), emptyList());
String expectedErrorMessage = format("[Test] %nFile:%n <abc>%nand file:%n <xyz>%ndo not have same content:%n");
assertThat(factory.create(new TextDescription("Test"), new StandardRepresentation())).isEqualTo(expectedErrorMessage);
}
Aggregations