Search in sources :

Example 81 with TestDescription

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

the class ShouldHaveComparableElementsAccordingToComparator_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] %nsome elements are not mutually comparable according to CaseInsensitiveStringComparator comparator in group:%n" + "<[\"b\", \"c\", \"a\"]>"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 82 with TestDescription

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

the class ShouldHaveToString_create_Test method should_create_error_message.

@Test
public void should_create_error_message() {
    String actual = "c++";
    String expectedToString = "java";
    String errorMessage = shouldHaveToString(actual, expectedToString).create(new TestDescription("TEST"), new StandardRepresentation());
    assertThat(errorMessage).isEqualTo(format("[TEST] %n" + "Expecting actual's toString() to return:%n" + "  <\"java\">%n" + "but was:%n" + "  <\"c++\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) ShouldHaveToString.shouldHaveToString(org.assertj.core.error.ShouldHaveToString.shouldHaveToString) Test(org.junit.Test)

Example 83 with TestDescription

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

the class BasicErrorMessageFactory_create_Test method should_create_error_with_configured_representation.

@Test
public void should_create_error_with_configured_representation() {
    Description description = new TestDescription("Test");
    String formattedMessage = "[Test] Hello Yoda";
    when(formatter.format(eq(description), same(CONFIGURATION_PROVIDER.representation()), eq("Hello %s"), eq("Yoda"))).thenReturn(formattedMessage);
    assertThat(factory.create(description)).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) Test(org.junit.Test)

Example 84 with TestDescription

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

the class ClassModifierShouldBe_create_Test method should_create_error_message_for_is_final.

@Test
public void should_create_error_message_for_is_final() {
    String error = shouldBeFinal(Object.class).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <java.lang.Object>%n" + "to be a \"final\" class but was \"public\"."));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) Test(org.junit.Test)

Example 85 with TestDescription

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

the class ClassModifierShouldBe_create_Test method should_create_error_message_for_is_not_final.

@Test
public void should_create_error_message_for_is_not_final() {
    String error = shouldNotBeFinal(String.class).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <java.lang.String>%n" + "not to be a \"final\" class but was \"public final\"."));
}
Also used : 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