Search in sources :

Example 71 with TestDescription

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

the class ShouldNotBeEqualNormalizingWhitespace_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" + "after whitespace differences are normalized"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 72 with TestDescription

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

the class ShouldNotBeEqualWithinOffset_create_Test method should_create_error_message.

@Test
public void should_create_error_message() {
    // GIVEN
    ErrorMessageFactory factory = shouldNotBeEqual(8f, 6f, offset(5f), 2f);
    // WHEN
    String message = factory.create(new TestDescription("Test"), STANDARD_REPRESENTATION);
    // THEN
    assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + "  <8.0f>%n" + "not to be close to:%n" + "  <6.0f>%n" + "by less than <5.0f> but difference was <2.0f>.%n" + "(a difference of exactly <5.0f> being considered invalid)"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) Test(org.junit.Test)

Example 73 with TestDescription

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

the class ShouldNotBeEqualWithinOffset_create_Test method should_create_error_message_for_strict_offset.

@Test
public void should_create_error_message_for_strict_offset() {
    // GIVEN
    ErrorMessageFactory factory = shouldNotBeEqual(8f, 6f, byLessThan(5f), 2f);
    // WHEN
    String message = factory.create(new TestDescription("Test"), STANDARD_REPRESENTATION);
    // THEN
    assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + "  <8.0f>%n" + "not to be close to:%n" + "  <6.0f>%n" + "by less than <5.0f> but difference was <2.0f>.%n" + "(a difference of exactly <5.0f> being considered valid)"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) Test(org.junit.Test)

Example 74 with TestDescription

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

the class ShouldBeCancelled_create_Test method should_create_error_message.

@Test
public void should_create_error_message() throws Exception {
    String error = shouldBeCancelled(new CompletableFuture<>()).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting%n" + "  <CompletableFuture[Incomplete]>%n" + "to be cancelled.%n%s", WARNING));
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) TestDescription(org.assertj.core.internal.TestDescription) Test(org.junit.Test)

Example 75 with TestDescription

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

the class ShouldBeCompleted_create_Test method should_create_error_message.

@Test
public void should_create_error_message() throws Exception {
    String error = shouldBeCompleted(new CompletableFuture<>()).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting%n" + "  <CompletableFuture[Incomplete]>%n" + "to be completed.%n%s", WARNING));
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) TestDescription(org.assertj.core.internal.TestDescription) 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