Search in sources :

Example 56 with TestDescription

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

the class ShouldHaveUserInfo_create_Test method should_create_error_message_for_uri_has_user_info.

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

Example 57 with TestDescription

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

the class ShouldHaveStamp_create_Test method should_create_error_message.

@Test
public void should_create_error_message() throws Exception {
    // GIVEN
    AtomicStampedReference<String> actual = new AtomicStampedReference<>("foo", 1234);
    // WHEN
    String message = shouldHaveStamp(actual, 5678).create(new TestDescription("TEST"), CONFIGURATION_PROVIDER.representation());
    // THEN
    assertThat(message).isEqualTo(format("[TEST] %n" + "Expecting%n" + "  <AtomicStampedReference[stamp=1234, reference=\"foo\"]>%n" + "to have stamp:%n" + "  <5678>%n" + "but had:%n" + "  <1234>"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) AtomicStampedReference(java.util.concurrent.atomic.AtomicStampedReference) Test(org.junit.Test)

Example 58 with TestDescription

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

the class ShouldNotBeEmpty_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(String.format("[Test] %nExpecting actual not to be empty"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation)

Example 59 with TestDescription

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

the class ShouldNotBeEqualIgnoringCase_create_Test method should_create_error_message.

@Test
public void should_create_error_message() {
    String message = factory.create(new TestDescription("Test"));
    assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + "  <\"Yoda\">%n" + "not to be equal to:%n" + "  <\"Luke\">%n" + "ignoring case considerations"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) Test(org.junit.Test)

Example 60 with TestDescription

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

the class ShouldNotBeEqualIgnoringWhitespace_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(String.format("[Test] %n" + "Expecting:%n" + "  <\" my\tfoo bar \">%n" + "not to be equal to:%n" + "  <\" my  foo bar \">%n" + "ignoring whitespace differences"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) 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