Search in sources :

Example 41 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ShouldBeSymbolicLink_create_Test method should_create_error_message.

@Test
public void should_create_error_message() {
    final Path actual = mock(Path.class);
    String actualMessage = shouldBeSymbolicLink(actual).create(new TextDescription("Test"));
    assertThat(actualMessage).isEqualTo(format("[Test] " + SHOULD_BE_SYMBOLIC_LINK, actual));
}
Also used : Path(java.nio.file.Path) TextDescription(org.assertj.core.description.TextDescription) Test(org.junit.Test)

Example 42 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ShouldBe_create_Test method should_create_error_message.

@Test
public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(String.format("[Test] %nExpecting:%n <\"Yoda\">%nto be <green>"));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 43 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ShouldBeEqualWithTimePrecision_create_Test method should_create_error_message_ignoring_milliseconds.

@Test
public void should_create_error_message_ignoring_milliseconds() {
    ErrorMessageFactory factory = shouldBeEqual(parseDatetimeWithMs("2011-01-01T05:00:00.000"), parseDatetimeWithMs("2011-01-01T06:05:17.003"), TimeUnit.MILLISECONDS);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(format("[Test] %nExpecting:%n" + "  <2011-01-01T05:00:00.000>%n" + "to have same year, month, day, hour, minute and second as:%n" + "  <2011-01-01T06:05:17.003>%n" + "but had not."));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 44 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ShouldBeEqualWithTimePrecision_create_Test method should_create_error_message_ignoring_seconds.

@Test
public void should_create_error_message_ignoring_seconds() {
    ErrorMessageFactory factory = shouldBeEqual(parseDatetimeWithMs("2011-01-01T05:00:00.000"), parseDatetimeWithMs("2011-01-01T06:05:17.003"), TimeUnit.SECONDS);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(format("[Test] %nExpecting:%n" + "  <2011-01-01T05:00:00.000>%n" + "to have same year, month, day, hour and minute as:%n" + "  <2011-01-01T06:05:17.003>%n" + "but had not."));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Example 45 with TextDescription

use of org.assertj.core.description.TextDescription in project assertj-core by joel-costigliola.

the class ShouldBeEqualWithTimePrecision_create_Test method should_create_error_message_ignoring_minutes.

@Test
public void should_create_error_message_ignoring_minutes() {
    ErrorMessageFactory factory = shouldBeEqual(parseDatetimeWithMs("2011-01-01T05:00:00.000"), parseDatetimeWithMs("2011-01-01T06:05:17.003"), TimeUnit.MINUTES);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo(format("[Test] %nExpecting:%n" + "  <2011-01-01T05:00:00.000>%n" + "to have same year, month, day and hour as:%n" + "  <2011-01-01T06:05:17.003>%n" + "but had not."));
}
Also used : TextDescription(org.assertj.core.description.TextDescription) StandardRepresentation(org.assertj.core.presentation.StandardRepresentation) Test(org.junit.Test)

Aggregations

TextDescription (org.assertj.core.description.TextDescription)210 Test (org.junit.Test)210 StandardRepresentation (org.assertj.core.presentation.StandardRepresentation)157 ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)24 PredicateDescription (org.assertj.core.presentation.PredicateDescription)8 Jedi (org.assertj.core.test.Jedi)6 Path (java.nio.file.Path)4 Integer.toHexString (java.lang.Integer.toHexString)3 Date (java.util.Date)3 Description (org.assertj.core.description.Description)3 Difference (org.assertj.core.internal.DeepDifference.Difference)3 BaseTest (org.assertj.core.api.BaseTest)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 LongPredicate (java.util.function.LongPredicate)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 LongStream (java.util.stream.LongStream)1