Search in sources :

Example 66 with TestDescription

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

the class ShouldNotBeCancelled_create_Test method should_create_error_message.

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

Example 67 with TestDescription

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

the class ShouldNotBeCompleted_create_Test method should_create_error_message.

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

Example 68 with TestDescription

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

the class ShouldNotHaveCompletedExceptionally_create_Test method should_create_error_message.

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

Example 69 with TestDescription

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

the class ShouldBeAbsolutePath_create_Test method setUp.

@Before
public void setUp() {
    description = new TestDescription("Test");
    representation = new StandardRepresentation();
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Before(org.junit.Before)

Example 70 with TestDescription

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

the class BasicErrorMessageFactory_create_Test method should_implement_toString.

@Test
public void should_implement_toString() {
    Description description = new TestDescription("Test");
    Representation representation = new StandardRepresentation();
    String formattedMessage = "[Test] Hello Yoda";
    when(formatter.format(description, representation, "Hello %s", "Yoda")).thenReturn(formattedMessage);
    assertThat(factory.create(description, representation)).isEqualTo(formattedMessage);
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) Description(org.assertj.core.description.Description) EmptyTextDescription.emptyDescription(org.assertj.core.description.EmptyTextDescription.emptyDescription) TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Representation(org.assertj.core.presentation.Representation) 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