Search in sources :

Example 26 with TestDescription

use of org.assertj.core.internal.TestDescription 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)]>"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 27 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldStartWithPath_create_Test method should_create_error_message.

@Test
public void should_create_error_message() {
    final Path actual = mock(Path.class);
    final Path other = mock(Path.class);
    String actualMessage = shouldStartWith(actual, other).create(new TestDescription("Test"), new StandardRepresentation());
    assertThat(actualMessage).isEqualTo(String.format("[Test] " + PATH_SHOULD_START_WITH, actual, other));
}
Also used : Path(java.nio.file.Path) TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 28 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveAnchor_create_Test method should_create_error_message_for_has_anchor.

@Test
public void should_create_error_message_for_has_anchor() throws Exception {
    URL uri = new URL("http://assertj.org/news#print");
    String error = shouldHaveAnchor(uri, "foo").create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting anchor of%n" + "  <http://assertj.org/news#print>%n" + "to be:%n" + "  <\"foo\">%n" + "but was:%n" + "  <\"print\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URL(java.net.URL) Test(org.junit.Test)

Example 29 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveAnchor_create_Test method should_create_error_message_for_has_no_anchor.

@Test
public void should_create_error_message_for_has_no_anchor() throws Exception {
    URL uri = new URL("http://assertj.org/news#print");
    String error = shouldHaveAnchor(uri, null).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <http://assertj.org/news#print>%n" + "not to have an anchor but had:%n" + "  <\"print\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URL(java.net.URL) Test(org.junit.Test)

Example 30 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveAuthority_create_Test method should_create_error_message_for_uri.

@Test
public void should_create_error_message_for_uri() throws Exception {
    URI uri = new URI("http://assertj.org:8080/news");
    String error = shouldHaveAuthority(uri, "foo.org").create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting authority of%n" + "  <http://assertj.org:8080/news>%n" + "to be:%n" + "  <\"foo.org\">%n" + "but was:%n" + "  <\"assertj.org:8080\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URI(java.net.URI) Test(org.junit.Test)

Aggregations

TestDescription (org.assertj.core.internal.TestDescription)126 Test (org.junit.Test)112 StandardRepresentation (org.assertj.core.presentation.StandardRepresentation)48 URI (java.net.URI)27 URL (java.net.URL)24 CompletableFuture (java.util.concurrent.CompletableFuture)9 Before (org.junit.Before)9 Description (org.assertj.core.description.Description)4 Path (java.nio.file.Path)2 EmptyTextDescription.emptyDescription (org.assertj.core.description.EmptyTextDescription.emptyDescription)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 AtomicStampedReference (java.util.concurrent.atomic.AtomicStampedReference)1 ShouldHaveToString.shouldHaveToString (org.assertj.core.error.ShouldHaveToString.shouldHaveToString)1 Representation (org.assertj.core.presentation.Representation)1 CaseInsensitiveStringComparator (org.assertj.core.util.CaseInsensitiveStringComparator)1